Last change
on this file since 7ed1069 was 0924b6c, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
966 bytes
|
Rev | Line | |
---|
[0924b6c] | 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 sent email to you.");
|
---|
| 36 |
|
---|
| 37 | return redirect()->route("auth.forgotShow");
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.