Last change
on this file since 1451c6f 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
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Http\Controllers\Auth;
|
---|
4 |
|
---|
5 | use App\Helpers\Alert;
|
---|
6 | use App\Http\Requests\Auth\ForgotPasswordRequest;
|
---|
7 | use App\Models\User;
|
---|
8 | use App\Http\Controllers\Controller;
|
---|
9 | use App\Notifications\ForgotPassword;
|
---|
10 |
|
---|
11 | class 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 |
|
---|
36 | Alert::flash( "We have sent an email to your inbox", "error");
|
---|
37 |
|
---|
38 | return redirect()->route("auth.forgotShow");
|
---|
39 | }
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.