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

Last change on this file since f457265 was 0924b6c, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago

initial commit

  • Property mode set to 100644
File size: 966 bytes
RevLine 
[0924b6c]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 sent email to you.");
36
37 return redirect()->route("auth.forgotShow");
38 }
39}
Note: See TracBrowser for help on using the repository browser.