Anuj-Panthri commited on
Commit
1251c2f
·
1 Parent(s): d57331c

made login and signup working

Browse files
.env.example CHANGED
@@ -8,7 +8,7 @@ LOG_CHANNEL=stack
8
  LOG_DEPRECATIONS_CHANNEL=null
9
  LOG_LEVEL=debug
10
 
11
- DB_CONNECTION=ṣqlite
12
  # DB_CONNECTION=mysql
13
  # DB_HOST=127.0.0.1
14
  # DB_PORT=3306
 
8
  LOG_DEPRECATIONS_CHANNEL=null
9
  LOG_LEVEL=debug
10
 
11
+ DB_CONNECTION=sqlite
12
  # DB_CONNECTION=mysql
13
  # DB_HOST=127.0.0.1
14
  # DB_PORT=3306
README.md CHANGED
@@ -5,8 +5,8 @@ # Learn Guide
5
  ## Tasks :-
6
 
7
  - [X] Create Home Page
8
- - [ ] Create Login Page
9
- - [ ] Create Signup Page
10
  - [ ] Create an simple Dashboard page
11
 
12
 
 
5
  ## Tasks :-
6
 
7
  - [X] Create Home Page
8
+ - [X] Create Login Page
9
+ - [X] Create Signup Page
10
  - [ ] Create an simple Dashboard page
11
 
12
 
app/Http/Controllers/DashboardController.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace App\Http\Controllers;
4
+
5
+ use Illuminate\Http\Request;
6
+ // use
7
+
8
+ class DashboardController extends Controller
9
+ {
10
+ public function home(){
11
+ return view('dashboard.home');
12
+ }
13
+ }
app/Http/Controllers/HomeController.php CHANGED
@@ -3,6 +3,9 @@
3
  namespace App\Http\Controllers;
4
 
5
  use Illuminate\Http\Request;
 
 
 
6
 
7
  class HomeController extends Controller
8
  {
@@ -10,4 +13,85 @@ class HomeController extends Controller
10
  public function home(){
11
  return view("home");
12
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
 
3
  namespace App\Http\Controllers;
4
 
5
  use Illuminate\Http\Request;
6
+ use App\Models\CustomUser;
7
+ use Auth;
8
+ use Hash;
9
 
10
  class HomeController extends Controller
11
  {
 
13
  public function home(){
14
  return view("home");
15
  }
16
+ public function login_form(){
17
+ return view("login");
18
+ }
19
+ public function signup_form(){
20
+ return view("signup");
21
+ }
22
+
23
+ public function signup(Request $request){
24
+ // username and password
25
+ $request->validate([
26
+ "username"=>[
27
+ "required",
28
+ "string",
29
+ "regex:/^[a-z][a-z0-9-]*[a-z0-9]$/", // regex for a-z 0-9 and - in middle
30
+ "unique:App\Models\CustomUser", // username shouldn't exist in db
31
+ ],
32
+ "password"=>[
33
+ "required",
34
+ "string",
35
+ "min:1",
36
+ "max:30",
37
+ ],
38
+ "confirm_password"=>[
39
+ "required",
40
+ "string",
41
+ "min:1",
42
+ "max:30",
43
+ ],
44
+ ]);
45
+
46
+ // check if password matchs confirm password
47
+ \Log::info($request);
48
+ if($request['password']!=$request['confirm_password'])
49
+ {
50
+ // return error
51
+ return redirect()->back()->withErrors([
52
+ "confirm_password"=>"confirm password doesn't match the password"
53
+ ]);
54
+ }
55
+ // create user
56
+ $user = new CustomUser();
57
+ $user->username = $request->username;
58
+ $user->password = Hash::make($request->password);
59
+ $user->save();
60
+
61
+ return redirect(route("login.form"));
62
+ }
63
+
64
+ public function login(Request $request){
65
+ // username and password
66
+ $request->validate([
67
+ "username"=>[
68
+ "required",
69
+ "string",
70
+ "regex:/^[a-z][a-z0-9-]*[a-z0-9]$/", // regex for a-z 0-9 and - in middle
71
+ "exists:App\Models\CustomUser", // username should exist in db
72
+ ],
73
+ "password"=>[
74
+ "required",
75
+ "string",
76
+ "min:1",
77
+ "max:30",
78
+ ],
79
+ ]);
80
+
81
+ // \Log::info($request);
82
+ // login
83
+ $user = CustomUser::where("username",$request->username)->first();
84
+
85
+ if(!Hash::check($request->password, $user->password)){
86
+ // password is incorrect
87
+ Auth::guard('customuser')->logout();
88
+
89
+ return redirect()->back()->withErrors([
90
+ "password"=>"incorrect password"
91
+ ]);
92
+ }
93
+
94
+ Auth::guard('customuser')->login($user);
95
+ return redirect(route('dashboard'));
96
+ }
97
  }
app/Http/Kernel.php CHANGED
@@ -64,5 +64,6 @@ class Kernel extends HttpKernel
64
  'signed' => \App\Http\Middleware\ValidateSignature::class,
65
  'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
66
  'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
 
67
  ];
68
  }
 
64
  'signed' => \App\Http\Middleware\ValidateSignature::class,
65
  'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
66
  'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
67
+ 'is_customuser' => \App\Http\Middleware\isCustomUser::class, // custom middleware
68
  ];
69
  }
app/Http/Middleware/isCustomUser.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace App\Http\Middleware;
4
+
5
+ use Closure;
6
+ use Illuminate\Http\Request;
7
+ use Symfony\Component\HttpFoundation\Response;
8
+ use Auth;
9
+
10
+ class isCustomUser
11
+ {
12
+ /**
13
+ * Handle an incoming request.
14
+ *
15
+ * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
16
+ */
17
+ public function handle(Request $request, Closure $next)
18
+ {
19
+ if(Auth::guard('customuser')->check()){
20
+ return $next($request);
21
+ }
22
+
23
+ return redirect(route('login.form'));
24
+ }
25
+ }
app/Models/CustomUser.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace App\Models;
4
+
5
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
6
+ use Illuminate\Database\Eloquent\Model;
7
+ use Illuminate\Foundation\Auth\User as Authenticatable;
8
+ use Illuminate\Notifications\Notifiable;
9
+ use Laravel\Sanctum\HasApiTokens;
10
+
11
+ class CustomUser extends Authenticatable
12
+ {
13
+ use HasApiTokens, HasFactory, Notifiable;
14
+
15
+ protected $guard = "customuser";
16
+ }
config/auth.php CHANGED
@@ -40,6 +40,14 @@
40
  'driver' => 'session',
41
  'provider' => 'users',
42
  ],
 
 
 
 
 
 
 
 
43
  ],
44
 
45
  /*
@@ -64,6 +72,10 @@
64
  'driver' => 'eloquent',
65
  'model' => App\Models\User::class,
66
  ],
 
 
 
 
67
 
68
  // 'users' => [
69
  // 'driver' => 'database',
 
40
  'driver' => 'session',
41
  'provider' => 'users',
42
  ],
43
+ 'customuser' => [
44
+ 'driver' => 'session',
45
+ 'provider' => 'customuser',
46
+ ],
47
+ // 'web' => [
48
+ // 'driver' => 'session',
49
+ // 'provider' => 'users',
50
+ // ],
51
  ],
52
 
53
  /*
 
72
  'driver' => 'eloquent',
73
  'model' => App\Models\User::class,
74
  ],
75
+ 'customuser' => [
76
+ 'driver' => 'eloquent',
77
+ 'model' => App\Models\CustomUser::class,
78
+ ],
79
 
80
  // 'users' => [
81
  // 'driver' => 'database',
database/migrations/2023_12_30_142000_create_custom_users_table.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use Illuminate\Database\Migrations\Migration;
4
+ use Illuminate\Database\Schema\Blueprint;
5
+ use Illuminate\Support\Facades\Schema;
6
+
7
+ return new class extends Migration
8
+ {
9
+ /**
10
+ * Run the migrations.
11
+ */
12
+ public function up(): void
13
+ {
14
+ Schema::create('custom_users', function (Blueprint $table) {
15
+ $table->id();
16
+ $table->string('username')->unique();
17
+ $table->string('password');
18
+ $table->rememberToken();
19
+ $table->timestamps();
20
+ });
21
+ }
22
+
23
+ /**
24
+ * Reverse the migrations.
25
+ */
26
+ public function down(): void
27
+ {
28
+ Schema::dropIfExists('custom_users');
29
+ }
30
+ };
public/css/dashboard/home.css ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300&family=Roboto:wght@300&display=swap');
2
+
3
+ *{
4
+ margin:0;
5
+ padding:0;
6
+ box-sizing: border-box;
7
+ font-family: 'Poppins', sans-serif;
8
+ }
9
+
10
+ a{
11
+ color:#000;
12
+ /* border:none; */
13
+ text-decoration: none;
14
+ }
15
+
16
+ header{
17
+ height:80px;
18
+ background-color: #FFC3C3;
19
+ display: flex;
20
+ flex-direction: row;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ padding:0.7rem 2rem;
24
+ }
25
+ header .circle{
26
+ border:2px solid #000;
27
+ border-radius: 50%;
28
+ aspect-ratio: 1;
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ padding: 0.6rem;
33
+ }
34
+ header>.title{
35
+ font-size:2rem;
36
+ cursor: pointer;
37
+ }
38
+
39
+ header>.sub_header{
40
+ display: flex;
41
+ flex-direction: row;
42
+ align-items: center;
43
+ justify-content: space-between;
44
+ }
45
+
46
+ header>.sub_header a{
47
+ margin-inline:10px;
48
+ cursor: pointer;
49
+ }
50
+ header>.sub_header a:hover{
51
+ border-bottom:2px solid #000;
52
+ }
53
+
54
+ section{
55
+ min-height:400px;
56
+ border-bottom: 1px solid black;
57
+ padding:1rem 2rem;
58
+ }
59
+
60
+ section>p{
61
+ font-size:1.5rem;
62
+ width:50ch;
63
+ /* margin-inline:2rem; */
64
+ }
65
+ #get_started_btn{
66
+ background-color: #44d;
67
+ color:#fff;
68
+ border:none;
69
+ padding: 1em;
70
+ border-radius: 50px;
71
+ font-weight: 600;
72
+ font-size: 1rem;
73
+ cursor: pointer;
74
+ }
public/css/home.css CHANGED
@@ -7,6 +7,12 @@
7
  font-family: 'Poppins', sans-serif;
8
  }
9
 
 
 
 
 
 
 
10
  header{
11
  height:80px;
12
  background-color: #FFC3C3;
 
7
  font-family: 'Poppins', sans-serif;
8
  }
9
 
10
+ a{
11
+ color:#000;
12
+ /* border:none; */
13
+ text-decoration: none;
14
+ }
15
+
16
  header{
17
  height:80px;
18
  background-color: #FFC3C3;
public/css/login.css ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300&family=Roboto:wght@300&display=swap');
2
+
3
+ *{
4
+ margin:0;
5
+ padding:0;
6
+ box-sizing: border-box;
7
+ font-family: 'Poppins', sans-serif;
8
+ }
9
+
10
+ main{
11
+ width:100%;
12
+ min-height: 100vh;
13
+ /* background-color: rgb(0, 0, 0); */
14
+ padding: 2rem;
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ /* justify-content: center; */
19
+ }
20
+
21
+ header{
22
+ text-align: center;
23
+ }
24
+ form{
25
+ background-color: #FDC5C5;
26
+ border-radius: 20px;
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: center;
30
+ justify-content: space-evenly;
31
+ margin: 2rem;
32
+ padding: 2rem 1rem;
33
+ width:300px;
34
+ }
35
+ #form_title{
36
+ font-size: 2rem;
37
+ letter-spacing: 2px;
38
+ }
39
+
40
+ #input_container{
41
+ display: flex;
42
+ flex-direction: column;
43
+ align-items: center;
44
+ margin: 1rem 0;
45
+ width:100%;
46
+ }
47
+ .field{
48
+ display: flex;
49
+ flex-direction: column;
50
+ align-items: center;
51
+ width:100%;
52
+ }
53
+ .field>.error_msg{
54
+ color:#a22;
55
+ font-size: 0.8rem;
56
+ }
57
+ .field>input{
58
+ margin: 0.25rem 0;
59
+ border: none;
60
+ outline: none;
61
+ border-radius: 50px;
62
+ padding:0.5rem 1rem;
63
+ width:100%;
64
+ }
65
+
66
+ #submit_btn{
67
+ border: none;
68
+ outline: none;
69
+ border-radius: 50px;
70
+ padding:0.5rem 1rem;
71
+ background-color: #484848;
72
+ color:#fff;
73
+ cursor: pointer;
74
+ }
75
+ #submit_btn:focus,#submit_btn:hover{
76
+ outline: 2px solid #000000;
77
+ }
78
+
79
+ a{
80
+ color:hsl(234, 100%, 56%);
81
+ }
82
+ a:hover,a:active,a:focus{
83
+ color:hsl(234, 50%, 30%);
84
+ }
resources/views/components/bottomup.blade.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .bottomup_container{
3
+ background:#61F867;
4
+ aspect-ratio:1;
5
+ height:200px;
6
+
7
+ border-radius:10px;
8
+ color:#fff;
9
+ padding:20px;
10
+ display:flex;
11
+ flex-direction:column;
12
+ align-items: center;
13
+ justify-content: center;
14
+ }
15
+ .bottomup_container p{
16
+ width:fit-content;
17
+ }
18
+ .bottomup_container .triangle{
19
+ /* aspect-ratio:1; */
20
+ /* width:40%; */
21
+ margin-top:10px;
22
+ fill:#fff;
23
+ }
24
+ </style>
25
+ <div class="bottomup_container">
26
+ <p>Bottom Up</p>
27
+ <svg class="triangle" width=100 height=84>
28
+ <polygon points="50 0, 100 84, 0 84"/>
29
+ </svg>
30
+ <svg class="triangle" width=100 height=84>
31
+ <polygon points="50 0, 100 84, 0 84"/>
32
+ </svg>
33
+ </div>
resources/views/components/topdown.blade.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .topdown_container{
3
+ background:#6EA1EE;
4
+ aspect-ratio:1;
5
+ height:200px;
6
+
7
+ border-radius:10px;
8
+ color:#fff;
9
+ padding:20px;
10
+ display:flex;
11
+ flex-direction:column;
12
+ align-items: center;
13
+ justify-content: center;
14
+ }
15
+ .topdown_container p{
16
+ width:fit-content;
17
+ }
18
+ .topdown_container .triangle{
19
+ /* aspect-ratio:1; */
20
+ /* width:40%; */
21
+ margin-top:10px;
22
+ fill:#fff;
23
+ transform: rotate(180deg);
24
+ }
25
+ </style>
26
+ <div class="topdown_container">
27
+ <p>Top Down</p>
28
+ <svg class="triangle" width=100 height=84>
29
+ <polygon points="50 0, 100 84, 0 84"/>
30
+ </svg>
31
+ <svg class="triangle" width=100 height=84>
32
+ <polygon points="50 0, 100 84, 0 84"/>
33
+ </svg>
34
+ </div>
resources/views/dashboard/home.blade.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
+ <title>Learn Guide | Home Page</title>
8
+ <link rel="stylesheet" href="{{ asset('css/dashboard/home.css') }}">
9
+ </head>
10
+
11
+ <body>
12
+ <header>
13
+ <a class='title' href="{{ route('home') }}">LearnGuide</a>
14
+ <div class="sub_header">
15
+ <div>
16
+ <a href="{{ route('dashboard') }}">Dashboard</a>
17
+ <a>My Skills</a>
18
+ <a>Explore</a>
19
+ </div>
20
+ <div class='circle'>
21
+ {{ Auth::guard('customuser')->user()->username }}
22
+ </div>
23
+ </div>
24
+ </header>
25
+ <section>
26
+ <p>
27
+ you should start learning the skills which interests you or which can help you with your career.
28
+ </p>
29
+ <button id="get_started_btn">Get Started</button>
30
+ @include('components.topdown')
31
+ @include('components.bottomup')
32
+ </section>
33
+ </body>
34
+
35
+ </html>
resources/views/home.blade.php CHANGED
@@ -18,7 +18,7 @@
18
  <a>Explore</a>
19
  </div>
20
  <div>
21
- <a>Login</a>
22
  </div>
23
  </div>
24
  </header>
@@ -34,15 +34,15 @@
34
  <section id='topdown_container'>
35
  <h2 class="heading">Top Down Approach</h2>
36
  <div class="main_section">
37
- <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Corrupti vel vero quia impedit! Fuga unde recusandae eum minima. At eius, sequi dolore nostrum optio veritatis aliquid voluptate nesciunt! Libero, at?</p>
38
- <img src="{{ asset('images/keep_learning.png') }}">
39
  </div>
40
  </section>
41
  <section id='bottomup_container'>
42
  <h2 class="heading">Bottom Up Approach</h2>
43
  <div class="main_section">
44
- <img src="{{ asset('images/keep_learning.png') }}">
45
- <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Corrupti vel vero quia impedit! Fuga unde recusandae eum minima. At eius, sequi dolore nostrum optio veritatis aliquid voluptate nesciunt! Libero, at?</p>
46
  </div>
47
  </section>
48
 
 
18
  <a>Explore</a>
19
  </div>
20
  <div>
21
+ <a href="{{ route('login.form') }}">Login</a>
22
  </div>
23
  </div>
24
  </header>
 
34
  <section id='topdown_container'>
35
  <h2 class="heading">Top Down Approach</h2>
36
  <div class="main_section">
37
+ <p>Top-down learning is a teaching style that focuses on providing students a large view of a subject, without explaining the components that make up the subject. It is based on the idea that a teacher drives the classroom and determines what is to be taught. Top-down learning also involves perceiving the world by drawing from what we already know in order to interpret new information. Top-down learning is influenced by higher mental processes such as expectations, beliefs, values, and social influences.</p>
38
+ @include('components.topdown')
39
  </div>
40
  </section>
41
  <section id='bottomup_container'>
42
  <h2 class="heading">Bottom Up Approach</h2>
43
  <div class="main_section">
44
+ @include('components.bottomup')
45
+ <p>Bottom-up learning is a teaching style that focuses on providing students the components that make up a subject, and then building up to a larger view of the subject. It is based on the idea that students are active learners who construct their own knowledge from the bottom up. Bottom-up learning also involves perceiving the world by processing sensory information and building up to higher levels of cognition. Bottom-up learning is influenced by lower mental processes such as perception, attention, memory, and reasoning.</p>
46
  </div>
47
  </section>
48
 
resources/views/login.blade.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html lang="en">
2
+
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
+ <title>Login</title>
8
+ <link rel="stylesheet" href="{{ asset('css/login.css') }}">
9
+ </head>
10
+
11
+ <body>
12
+ <main>
13
+ <header>
14
+ <h1>Learn Guide</h1>
15
+ <h4>use Learn Guide to learn how to learn skills efficently</h4>
16
+ </header>
17
+ <form method="POST" action="{{ route('login') }}">
18
+ @csrf
19
+ <h3 id="form_title">Login</h3>
20
+ <div id="input_container">
21
+ <div class="field">
22
+ <input type="text" name="username" value="{{ old('username') }}" placeholder="Username">
23
+ <span class="error_msg">
24
+ @error('username')
25
+ {{ $message }}
26
+ @enderror
27
+ </span>
28
+ </div>
29
+ <div class="field">
30
+
31
+ <input type="password" name="password" placeholder="Password">
32
+ <span class="error_msg">
33
+ @error('password')
34
+ {{ $message }}
35
+ @enderror
36
+ </span>
37
+ </div>
38
+
39
+ </div>
40
+ <input type="submit" id="submit_btn" value="Login">
41
+ </form>
42
+ <p>new to learn guide ? <a href="{{ route('signup.form') }}">Sign up now</a></p>
43
+ </main>
44
+ </body>
45
+
46
+ </html>
resources/views/signup.blade.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html lang="en">
2
+
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
+ <title>Signup</title>
8
+ <link rel="stylesheet" href="{{ asset('css/login.css') }}">
9
+ </head>
10
+
11
+ <body>
12
+ <main>
13
+ <header>
14
+ <h1>Learn Guide</h1>
15
+ <h4>use Learn Guide to learn how to learn skills efficently</h4>
16
+ </header>
17
+ <form method="POST" action="{{ route('signup') }}">
18
+ @csrf
19
+ <h3 id="form_title">Signup</h3>
20
+ <div id="input_container">
21
+ <div class="field">
22
+ <input type="text" name="username" value="{{ old('username') }}" placeholder="Username">
23
+ <span class="error_msg">
24
+ @error('username')
25
+ {{ $message }}
26
+ @enderror
27
+ </span>
28
+ </div>
29
+ <div class="field">
30
+
31
+ <input type="password" name="password" placeholder="Password">
32
+ <span class="error_msg">
33
+ @error('password')
34
+ {{ $message }}
35
+ @enderror
36
+ </span>
37
+ </div>
38
+ <div class="field">
39
+
40
+ <input type="password" name="confirm_password" placeholder="Confirm password">
41
+ <span class="error_msg">
42
+ @error('confirm_password')
43
+ {{ $message }}
44
+ @enderror
45
+ </span>
46
+ </div>
47
+ </div>
48
+ <input type="submit" id="submit_btn" value="Login">
49
+ </form>
50
+ <p>Already have an account? <a href="{{ route('login.form') }}">Log in</a></p>
51
+ </main>
52
+ </body>
53
+
54
+ </html>
routes/web.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  use Illuminate\Support\Facades\Route;
4
  use App\Http\Controllers\HomeController;
 
5
  /*
6
  |--------------------------------------------------------------------------
7
  | Web Routes
@@ -15,4 +16,14 @@
15
 
16
  Route::prefix("/")->controller(HomeController::class)->group(function(){
17
  Route::get('/','home')->name("home");
 
 
 
 
 
 
 
 
 
 
18
  });
 
2
 
3
  use Illuminate\Support\Facades\Route;
4
  use App\Http\Controllers\HomeController;
5
+ use App\Http\Controllers\DashboardController;
6
  /*
7
  |--------------------------------------------------------------------------
8
  | Web Routes
 
16
 
17
  Route::prefix("/")->controller(HomeController::class)->group(function(){
18
  Route::get('/','home')->name("home");
19
+ Route::get('/login','login_form')->name("login.form");
20
+ Route::get('/signup','signup_form')->name("signup.form");
21
+ Route::post('/login/verify','login')->name("login");
22
+ Route::post('/signup/verify','signup')->name("signup");
23
+ });
24
+
25
+ Route::prefix('/dashboard')->middleware('is_customuser')->controller(DashboardController::class)->group(function(){
26
+
27
+ Route::get("/",'home')->name("dashboard");
28
+
29
  });