示例#1
0
 /**
  * 修该用户密码的时候的表单验证
  *
  * @access public
  */
 public function password(\App\Services\Admin\User\Param\UserModifyPassword $data)
 {
     $rules = array('oldPassword' => 'required', 'newPassword' => 'required', 'newPasswordRepeat' => 'required');
     $messages = array('oldPassword.required' => Lang::get('user.password_empty'), 'newPassword.required' => Lang::get('user.new_password_empty'), 'newPasswordRepeat.required' => Lang::get('user.newPasswordRepeat'));
     $validator = Validator::make($data->toArray(), $rules, $messages);
     if ($validator->fails()) {
         $this->errorMsg = $validator->messages()->first();
         return false;
     }
     if ($data->newPassword != $data->newPasswordRepeat) {
         $this->errorMsg = Lang::get('user.password_comfirm');
         return false;
     }
     return true;
 }
示例#2
0
 /**
  * 修改自己的密码
  */
 public function mpassword(UserModifyPassword $params, UserProcess $manager, LoginProcess $loginManager)
 {
     $params->setOldPassword(Request::input('old_password'))->setNewPassword(Request::input('new_password'))->setNewPasswordRepeat(Request::input('new_password_repeat'));
     if (!$manager->modifyPassword($params)) {
         return responseJson($manager->getErrorMessage());
     }
     $loginManager->getProcess()->logout();
     return responseJson(Lang::get('common.action_success'), true);
 }