示例#1
0
 /**
  * Email方式注册用户处理逻辑
  *
  * @param  null
  * @return view
  */
 public function postEmailRegister(Request $request)
 {
     $userInfo = array('email' => $request->get('email'), 'password' => $request->get('password'), 'password_confirmation' => $request->get('password_confirmation'), 'cpt' => $request->get('cpt'));
     $validator = ValidRule::validator($userInfo, 'email_reg');
     if ($validator->passes()) {
         $userInfo['active'] = false;
         $user = $this->create($userInfo);
         if (is_object($user)) {
             $this->sendActivatedMail($user);
             return redirect('login/email')->withErrors('恭喜您注册成功!请先去邮箱进行激活');
         } else {
             return redirect('register/email')->withErrors('注册失败,请再试一次');
         }
     } else {
         return redirect('register/email')->withErrors($validator);
     }
 }
示例#2
0
 /**
  * 用户新密码提交以后,再此验证并存入数据库
  * @param $request
  * @return null
  */
 public function postEmailReset(Request $request)
 {
     $userInfo = array('email' => $request->get('email'), 'password' => $request->get('password'), 'password_confirmation' => $request->get('password_confirmation'), 'token' => $request->get('token'));
     $validator = ValidRule::validator($userInfo, 'post_email_reset');
     if ($validator->passes()) {
         $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
         $response = Password::reset($credentials, function ($user, $password) {
             $this->resetPassword($user, $password);
         });
         switch ($response) {
             case Password::PASSWORD_RESET:
                 return redirect('/')->withErrors('修改密码成功,E行动欢迎您超人归来');
             default:
                 return redirect('reset/email')->withErrors('密码修改失败,请从头来过');
         }
     } else {
         return redirect()->back()->withErrors($validator);
     }
 }