source: app/Http/Controllers/Auth/ForgotPasswordController.php@ 195c3cf

develop
Last change on this file since 195c3cf was 7304c7f, checked in by beratkjufliju <kufliju@…>, 3 years ago

added user authentication, create & forgot password methods and blades

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