1
0
mirror of https://github.com/flarum/core.git synced 2025-07-29 20:50:28 +02:00

Finish signup process, including state restoration

This commit is contained in:
Toby Zerner
2015-02-25 15:34:02 +10:30
parent 076be26001
commit 9ea482254c
15 changed files with 62 additions and 29 deletions

View File

@@ -6,10 +6,10 @@ use Flarum\Core\Exceptions\InvalidConfirmationTokenException;
use Flarum\Core\Events\UserWasDeleted;
use Flarum\Core\Events\UserWasRegistered;
use Flarum\Core\Events\UserWasRenamed;
use Flarum\Core\Events\EmailWasChanged;
use Flarum\Core\Events\PasswordWasChanged;
use Flarum\Core\Events\UserEmailWasChanged;
use Flarum\Core\Events\UserPasswordWasChanged;
use Flarum\Core\Events\UserWasActivated;
use Flarum\Core\Events\EmailWasConfirmed;
use Flarum\Core\Events\UserEmailWasConfirmed;
class User extends Model
{
@@ -115,7 +115,7 @@ class User extends Model
{
if ($email !== $this->email) {
$this->email = $email;
$this->raise(new EmailWasChanged($this));
$this->raise(new UserEmailWasChanged($this));
}
return $this;
@@ -130,7 +130,7 @@ class User extends Model
public function changePassword($password)
{
$this->password = $password ? static::$hasher->make($password) : null;
$this->raise(new PasswordWasChanged($this));
$this->raise(new UserPasswordWasChanged($this));
return $this;
}
@@ -211,7 +211,7 @@ class User extends Model
$this->is_confirmed = true;
$this->confirmation_token = null;
$this->raise(new EmailWasConfirmed($this));
$this->raise(new UserEmailWasConfirmed($this));
return $this;
}
@@ -302,6 +302,16 @@ class User extends Model
return Permission::whereIn('grantee', $this->getGrantees());
}
/**
* Define the relationship with the user's access tokens.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function accessTokens()
{
return $this->hasMany('Flarum\Core\Models\AccessToken');
}
/**
* Set the hasher with which to hash passwords.
*