source:
app/Http/Controllers/Auth/CreatePasswordController.php@
6f7d3df
Last change on this file since 6f7d3df was 7304c7f, checked in by , 3 years ago | |
---|---|
|
|
File size: 909 bytes |
Line | |
---|---|
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 | |
38 | return redirect()->route("auth.loginShow"); |
39 | } |
40 | } |
Note:
See TracBrowser
for help on using the repository browser.