diff options
| author | Camil Staps | 2016-10-18 11:45:29 +0200 | 
|---|---|---|
| committer | Camil Staps | 2016-10-18 11:45:29 +0200 | 
| commit | bd271840496248553e634b2e325e34076666375c (patch) | |
| tree | e8fdbe56d6a1b365449e2cfb9b40bd75ff029fd9 | |
| parent | Suggetsions ordering (diff) | |
Fix authentication
| -rw-r--r-- | app/Http/Controllers/Auth/RegisterController.php | 2 | ||||
| -rw-r--r-- | app/User.php | 50 | 
2 files changed, 5 insertions, 47 deletions
| diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index ed46cab..29ec08a 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -67,7 +67,7 @@ class RegisterController extends Controller  			'email' => $data['email'],  		]); -		$user->password = $data['password']; +		$user->password = bcrypt($data['password']);  		$user->save(); diff --git a/app/User.php b/app/User.php index 6520bb6..ca14b40 100644 --- a/app/User.php +++ b/app/User.php @@ -18,21 +18,16 @@   */  namespace HebrewParseTrainer; -use Illuminate\Contracts\Auth\Authenticatable; -use Illuminate\Contracts\Auth\CanResetPassword; -use Illuminate\Auth\Passwords\CanResetPassword as CanResetPasswordTrait; -use Illuminate\Notifications\Notifiable;  use Illuminate\Database\Eloquent\Model;  use Illuminate\Support\Facades\Hash; +use Illuminate\Foundation\Auth\User as FoundationUser; -class User extends Model implements Authenticatable, CanResetPassword { - -	use CanResetPasswordTrait; -	use Notifiable; +class User extends FoundationUser {  	protected $table = 'users';  	public $timestamps = false; -	protected $fillable = ['email', 'name', 'isadmin']; +	protected $fillable = ['email', 'name', 'password', 'isadmin']; +	protected $hidden = ['password', 'remember_token'];  	const VOTE_WEIGHT_BASE = 5; @@ -58,41 +53,4 @@ class User extends Model implements Authenticatable, CanResetPassword {  		return floor(log($this->points, self::VOTE_WEIGHT_BASE));  	} -	public function verifyPassword($pass) { -		if (!Hash::check($pass, $this->password)) -			return false; - -		if (Hash::needsRehash($this->password)) { -			$this->password = $pass; -			$this->save(); -		} - -		return true; -	} - -	public function getAuthIdentifierName() { -		return 'id'; -	} - -	public function getAuthIdentifier() { -		return $this->id; -	} - -	public function getAuthPassword() { -		return $this->password; -	} - -	public function getRememberToken() { -		return $this->remember_token; -	} - -	public function setRememberToken($token) { -		$this->remember_token = $token; -		$this->save(); -	} - -	public function getRememberTokenName() { -		return 'remember_token'; -	} -  } | 
