remove not required methods
This commit is contained in:
@ -74,49 +74,4 @@ class RegistrationForm extends Model
|
|||||||
'password' => Yii::t('user', 'Password'),
|
'password' => Yii::t('user', 'Password'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a new user account. If registration was successful it will set flash message.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
if (!$this->validate()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var User $user */
|
|
||||||
$user = Yii::createObject(User::className());
|
|
||||||
$user->setScenario('register');
|
|
||||||
$this->loadAttributes($user);
|
|
||||||
|
|
||||||
if (!$user->register()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Yii::$app->session->setFlash(
|
|
||||||
'info',
|
|
||||||
Yii::t(
|
|
||||||
'user',
|
|
||||||
'Your account has been created and a message with further instructions has been sent to your email'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads attributes to the user model. You should override this method if you are going to add new fields to the
|
|
||||||
* registration form. You can read more in special guide.
|
|
||||||
*
|
|
||||||
* By default this method set all attributes of this model to the attributes of User model, so you should properly
|
|
||||||
* configure safe attributes of your User model.
|
|
||||||
*
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
protected function loadAttributes(User $user)
|
|
||||||
{
|
|
||||||
$user->setAttributes($this->attributes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user