develop
Last change
on this file since 5e56e8a 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
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Http\Controllers\Auth;
|
---|
4 |
|
---|
5 | use App\Http\Requests\Auth\ForgotPasswordRequest;
|
---|
6 | use App\Models\User;
|
---|
7 | use App\Http\Controllers\Controller;
|
---|
8 | use App\Notifications\ForgotPassword;
|
---|
9 |
|
---|
10 | class 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.