Last change
on this file since d25ba66 was d25ba66, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago |
ADD post confirmation with multiple phases, notification after succesfully password creation
|
-
Property mode
set to
100644
|
File size:
1001 bytes
|
Rev | Line | |
---|
[0924b6c] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Http\Controllers\Auth;
|
---|
| 4 |
|
---|
| 5 | use App\Http\Requests\Auth\CreatePasswordRequest;
|
---|
| 6 | use App\Models\User;
|
---|
| 7 | use App\Http\Controllers\Controller;
|
---|
| 8 |
|
---|
| 9 | class CreatePasswordController extends Controller
|
---|
| 10 | {
|
---|
| 11 | public function __construct()
|
---|
| 12 | {
|
---|
| 13 | $this->middleware("createPassword");
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | public function showCreatePassword($id, $token)
|
---|
| 17 | {
|
---|
| 18 | return view("auth.create_password")->with([
|
---|
| 19 | "id" => $id,
|
---|
| 20 | "token" => $token
|
---|
| 21 | ]);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | public function createPassword(CreatePasswordRequest $request, $id, $token)
|
---|
| 25 | {
|
---|
| 26 | $user = User::find($id);
|
---|
| 27 |
|
---|
| 28 | $user->password = bcrypt($request->password);
|
---|
| 29 | $user->is_active = true;
|
---|
| 30 | $user->is_confirmed = true;
|
---|
| 31 |
|
---|
| 32 | if ($user->is_forgot_password) {
|
---|
| 33 | $user->is_forgot_password = false;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | $user->save();
|
---|
| 37 |
|
---|
[d25ba66] | 38 | session()->flash("password_created", "You have created a password successfully!");
|
---|
| 39 |
|
---|
[0924b6c] | 40 | return redirect()->route("auth.loginShow");
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.