Added Google Two Factor Authentication. Closes #326.

This commit is contained in:
James Brooks
2015-01-09 09:03:07 +00:00
committed by James Brooks
parent 20f744602a
commit de4ecf636f
20 changed files with 320 additions and 75 deletions

View File

@@ -44,7 +44,7 @@ class User extends Model implements UserInterface, RemindableInterface
*
* @var string[]
*/
protected $hidden = ['password', 'remember_token'];
protected $hidden = ['password', 'remember_token', 'google_2fa_secret'];
/**
* The properties that cannot be mass assigned.
@@ -133,4 +133,14 @@ class User extends Model implements UserInterface, RemindableInterface
{
return (bool) $this->level;
}
/**
* Returns if a user has enabled two factor authentication.
*
* @return bool
*/
public function getHasEnabled2FAAttribute()
{
return (bool) (trim($this->google_2fa_secret) !== '');
}
}