source: app/Http/Controllers/Auth/CreatePasswordController.php@ 7ed1069

Last change on this file since 7ed1069 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
Line 
1<?php
2
3namespace App\Http\Controllers\Auth;
4
5use App\Http\Requests\Auth\CreatePasswordRequest;
6use App\Models\User;
7use App\Http\Controllers\Controller;
8
9class 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
38 session()->flash("password_created", "You have created a password successfully!");
39
40 return redirect()->route("auth.loginShow");
41 }
42}
Note: See TracBrowser for help on using the repository browser.