_user = $userModule->findOneUserByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('Wrong password reset token.'); } parent::__construct($config); } /** * @inheritdoc */ public function rules() { return [ ['password', 'required'], ['password', 'string', 'min' => 6], ]; } /** * Resets password. * * @return boolean if password was reset. */ public function resetPassword() { $userModule = UserModule::getInstance(); $user = $this->_user; $userModule->setPassword($user, $this->password); $userModule->removePasswordResetToken($user); return $user->save(); } public function attributeLabels() { return [ 'password' => 'Mot de passe', ]; } }