source: app/Http/Controllers/Auth/CreatePasswordController.php@ 7304c7f

develop
Last change on this file since 7304c7f 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: 909 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 return redirect()->route("auth.loginShow");
39 }
40}
Note: See TracBrowser for help on using the repository browser.