From 4b330fad0dcaccae001509c110cedb4f3ed8eea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 21 Jan 2016 02:37:40 +0100 Subject: [PATCH] TESTING: testing authentication --- app/Http/Controllers/Admin/Login.php | 2 +- app/Models/User.php | 80 ++++------------------------ 2 files changed, 10 insertions(+), 72 deletions(-) diff --git a/app/Http/Controllers/Admin/Login.php b/app/Http/Controllers/Admin/Login.php index 93ce6756..833124fd 100644 --- a/app/Http/Controllers/Admin/Login.php +++ b/app/Http/Controllers/Admin/Login.php @@ -27,7 +27,7 @@ class Login extends Controller return; } - if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) { + if (Auth::attempt($request->only('email', 'password'))) { echo "prihlaseni uspesne"; return; diff --git a/app/Models/User.php b/app/Models/User.php index c539cf36..3f688979 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,95 +2,33 @@ namespace App\Models; -use Illuminate\Contracts\Auth\Authenticatable; +use Illuminate\Auth\Authenticatable; +use Illuminate\Auth\Passwords\CanResetPassword; +use Illuminate\Contracts\Auth\Authenticatable as AuthenticableInterface; use Illuminate\Database\Eloquent\Model; +use Illuminate\Foundation\Auth\Access\Authorizable; /** * Class User */ -class User extends Model implements Authenticatable +class User extends Model implements AuthenticableInterface { - + use Authenticatable, Authorizable, CanResetPassword; public $timestamps = false; - protected $fillable = [ 'email', 'username', 'password', - 'remember_token', 'name', - 'status' ]; - protected $guarded = []; - /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = [ - 'password', 'remember_token', + 'password', + 'remember_token', ]; - - /** - * Get the name of the unique identifier for the user. - * - * @return string - */ - public function getAuthIdentifierName() - { - return $this->email; - } - - /** - * Get the unique identifier for the user. - * - * @return mixed - */ - public function getAuthIdentifier() - { - return $this->id; - } - - /** - * Get the password for the user. - * - * @return string - */ - public function getAuthPassword() - { - return $this->password; - } - - /** - * Get the token value for the "remember me" session. - * - * @return string - */ - public function getRememberToken() - { - return $this->remember_token; - } - - /** - * Set the token value for the "remember me" session. - * - * @param string $value - * - * @return void - */ - public function setRememberToken($value) - { - $this->remember_token = $value; - } - - /** - * Get the column name for the "remember me" token. - * - * @return string - */ - public function getRememberTokenName() - { - return 'remember_token'; - }} \ No newline at end of file +} \ No newline at end of file