Ejemplo n.º 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;
 }