Answer the question
In order to leave comments, you need to log in
Why doesn't authorization work in Laravel?
It seems that I do everything as it should, but there is a jamb with authorization.
So the User model:
class User extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
protected $primaryKey = 'id';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password', 'remember_token');
protected $fillable = array('username', 'email', 'telephone');
public static $rules = array(
'username' => 'required|min:2|alpha',
'email' => 'required|email|unique:users',
'telephone' => 'required|between:10,12',
'password' => 'required|alpha_num|between:8,12|confirmed',
'password_confirmation' => 'required|alpha_num|between:8,12'
);
}
public function postSignin()
{
if(Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), true)) {
return Redirect::to('/')->with('message', 'Добро пожаловать и знакомиться!)');
}
return Redirect::to('auth/signin')->with('message', 'Ошибочка вышла! Попробуйте еще раз ;)');
}
@if( Auth::check() )
Здравствуйте, {{ Auth::user()->username }} !<br/>
{{ HTML::link('auth/signout', 'Выход') }}
@else
{{ HTML::link('auth/signin', 'Вход') }} | {{ link_to('auth/signup', 'Регистрация') }}
@endif
@if(Session::has('message'))
<p class="alert">{{ Session::get('message') }}</p>
@endif
{{ HTML::link('auth/signin', 'Вход') }} | {{ link_to('auth/signup', 'Регистрация') }}
Answer the question
In order to leave comments, you need to log in
Have you changed the session settings in the session.php file? If not changed, then test with other session drivers. And also check if the group has write permissions (775) for the /app/storage folder.
And throw out the entire Session::all(), and see what it has.
Show what fields you have in the database.
Gathered the password in hash?
Either the token column is missing in the database or the password is not for the hash
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question