public function registerUser() { $user = new User(); $user->name = $this->name; $user->email = $this->email; $user->setPassword($this->password); $user->save(); return $user->hasErrors() ? false : $user; }
public function validatePassword() { $user = User::findOne(['email' => $this->email]); if (!is_null($user)) { if (\Yii::$app->security->validatePassword($this->password, $user->password)) { $this->user = $user; return true; } } return false; }