source: app/Http/Controllers/Auth/ForgotPasswordController.php@ c5e383e

Last change on this file since c5e383e was 1c25bcf, checked in by Berat Kjufliju <kufliju@…>, 3 years ago

added 2fa, bug fixes, edited blades

  • Property mode set to 100644
File size: 985 bytes
RevLine 
[7304c7f]1<?php
2
3namespace App\Http\Controllers\Auth;
4
[1c25bcf]5use App\Helpers\Alert;
[7304c7f]6use App\Http\Requests\Auth\ForgotPasswordRequest;
7use App\Models\User;
8use App\Http\Controllers\Controller;
9use App\Notifications\ForgotPassword;
10
11class ForgotPasswordController extends Controller
12{
13 public function __construct()
14 {
15 $this->middleware("guest");
16 }
17
18 public function showForgotPassword()
19 {
20 return view("auth.forgot");
21 }
22
23 public function forgotPassword(ForgotPasswordRequest $request)
24 {
25 $user = User::where("email", $request->email)->first();
26
27 $user->is_forgot_password = true;
28 $user->is_active = false;
29 $user->security_code = $user->generateSecurityCode();
30 $user->verify_token = $user->generateVerifyToken();
31
32 $user->save();
33
34 $user->notify(new ForgotPassword($user));
35
[1c25bcf]36 Alert::flash( "We have sent an email to your inbox", "error");
[7304c7f]37
38 return redirect()->route("auth.forgotShow");
39 }
40}
Note: See TracBrowser for help on using the repository browser.