コード例 #1
0
 public function makeRecoverRequest()
 {
     if (!User::exists('email', Request::input('email'))) {
         return redirect('signup');
     }
     $body = "<a href='" . url('/restore?k=' . User::$matched_row['remember_token']) . "' target='_blank'>";
     $body .= 'Click here to reset your password</a>';
     $mail = new Mailler();
     $mail->destinatary = User::$matched_row['email'];
     $mail->subject = 'Reset your Password';
     $mail->body = $body;
     $mail->sendMessage();
     return redirect('login');
 }
コード例 #2
0
ファイル: AuthController.php プロジェクト: brnbp/clockin
 public function register(\Illuminate\Http\Request $request)
 {
     // TODO: Validation
     // TODO: get username properly
     $this->validate($request, ['email' => 'required|email|unique:users,email', 'password' => 'same:passwordConfirmation', 'passwordConfirmation' => 'required']);
     $credentials = ['username' => str_random(10), 'email' => Request::input('email'), 'password' => Request::input('password')];
     try {
         User::create($credentials);
         $mailler = new Mailler();
         $mailler->subscribe($credentials['username'], $credentials['email']);
     } catch (QueryException $e) {
         $errorMessage = $e->errorInfo[2];
     }
     return redirect('/login')->with(['messages' => [['type' => isset($errorMessage) ? 'danger' : 'success', 'text' => isset($errorMessage) ?: 'Registration completed!']]]);
 }