diff --git a/.env.example b/.env.example index ea0665b..eb4b91e 100644 --- a/.env.example +++ b/.env.example @@ -8,12 +8,12 @@ LOG_CHANNEL=stack LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE=laravel -DB_USERNAME=root -DB_PASSWORD= +DB_CONNECTION=pgsql +DB_HOST=pgsql +DB_PORT=5432 +DB_DATABASE=intern_project +DB_USERNAME=postgres +DB_PASSWORD=password BROADCAST_DRIVER=log CACHE_DRIVER=file diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php new file mode 100644 index 0000000..387cf93 --- /dev/null +++ b/app/Http/Controllers/AdminController.php @@ -0,0 +1,35 @@ +guard('admin')->attempt($request->only(['username', 'password']))){ + return redirect(route('admin.dashboard')); + } + return redirect()->back()->with('message', 'Invalid Credentials'); + }catch(\Exception $e){ + return redirect()->back()->with('message', $e->getMessage()); + } + } + + + //logout module + public function logout(Request $request){ + Auth::guard('admin')->logout(); + return redirect('/admin-login'); + } +} diff --git a/app/Http/Controllers/AdminDataDetailsController.php b/app/Http/Controllers/AdminDataDetailsController.php deleted file mode 100644 index cb088ac..0000000 --- a/app/Http/Controllers/AdminDataDetailsController.php +++ /dev/null @@ -1,92 +0,0 @@ -only('username', 'password'); - - $credentials = $request->validated(); - - try{ - if(Auth::attempt($credentials)): - return redirect()->intended('/dashboard')->with('username', $credentials['username']); - endif; - }catch(\Exception $e){ - return redirect()->back()->with('error', $e->getMessage()); - } - - return redirect()->back()->with('message', 'Credentials do not match!'); - } - - - //Logout Functionality - public function logout(Request $request){ - - try{ - return redirect('admin-login')->with(Auth::logout()); - }catch(\Exception $e){ - - } - } - - /** - * Display the specified resource. - */ - public function show(AdminDataDetails $adminDataDetails) - { - // - } - - /** - * Show the form for editing the specified resource. - */ - public function edit(AdminDataDetails $adminDataDetails) - { - // - } - - /** - * Update the specified resource in storage. - */ - public function update(Request $request, AdminDataDetails $adminDataDetails) - { - // - } - - /** - * Remove the specified resource from storage. - */ - public function destroy(AdminDataDetails $adminDataDetails) - { - // - } -} diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 69644d1..e6a09e6 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers; -use App\Http\Requests\CategoryFormValidator; +use App\Http\Requests\CategoryRequest; use App\Models\Category; use Illuminate\Http\Request; @@ -23,23 +23,24 @@ public function index(Category $category) */ public function create(Category $category) { - return view('backend.modals.admin-add-category', ['datas' => $category->whereNull('parent_id') + $data = $category->whereNull('parent_id') ->orWhereHas('parent', fn ($query) => $query->whereNull('parent_id')) - ->get() - ]); + ->paginate(10); + return view('backend.modals.admin-add-category', ['datas' => $data]); } /** + * + * * Store a newly created resource in storage. */ - public function store(CategoryFormValidator $request) + public function store(CategoryRequest $request) { try{ Category::create([ 'category_name' => $request->category_name, 'parent_id' => $request->parent_id, ]); - return redirect()->back()->with('message', 'Category Inserted.'); }catch(\Exception $e){ return redirect()->back()->with('message', $e->getMessage()); @@ -61,11 +62,11 @@ public function edit(string $id) { try{ $editableData = Category::select('id', 'category_name','parent_id')->findOrFail($id); - $datas = Category::whereNull('parent_id') + $data = Category::whereNull('parent_id') ->orWhereHas('parent', fn ($query) => $query->whereNull('parent_id')) - ->get(); + ->paginate(10); return view('backend.modals.admin-edit-category', ['editableData' => $editableData], - ['datas' => $datas]); + ['datas' => $data]); }catch(\Exception $e){ } @@ -75,7 +76,7 @@ public function edit(string $id) /** * Update the specified resource in storage. */ - public function update(CategoryFormValidator $request) + public function update(CategoryRequest $request) { try{ Category::where('id', $request->category_id)->update([ @@ -85,7 +86,6 @@ public function update(CategoryFormValidator $request) return redirect()->back()->with('message', 'Edit Success!'); - // return redirect()->back()->with('message', 'Edit Failed!'); }catch(\Exception $e){ return redirect()->back()->with('message', $e->getMessage()); } diff --git a/app/Http/Controllers/PasswordResetController.php b/app/Http/Controllers/PasswordResetController.php index be9afb8..a3cde07 100644 --- a/app/Http/Controllers/PasswordResetController.php +++ b/app/Http/Controllers/PasswordResetController.php @@ -2,11 +2,10 @@ namespace App\Http\Controllers; -use App\Http\Requests\ForgotPasswordMailValidator; -use App\Http\Requests\ResetPasswordValidator; -use App\Models\User; +use App\Http\Requests\ForgotPasswordRequest; +use App\Http\Requests\ResetPasswordRequest; +use App\Models\Admin; use Illuminate\Http\RedirectResponse; -use Illuminate\Http\Request; use Illuminate\Support\Str; use Carbon\Carbon; use Illuminate\Support\Facades\DB; @@ -22,65 +21,49 @@ class PasswordResetController extends Controller */ public function index() { - // return view('backend.forgot-password'); } //send reset mail to the user - public function sendResetMail(ForgotPasswordMailValidator $request) + public function sendResetMail(ForgotPasswordRequest $request) { $token = Str::random(64); - try{ DB::table('password_reset_tokens')->insert([ 'email' => $request->validated()['email'], 'token' => $token, "created_at" => Carbon::now(), ]); - - Mail::send('backend.resetPasswordLink', ['token' => $token], function($message) use($request){ + Mail::send('backend.reset-password-link', ['token' => $token], function($message) use($request){ $message->to($request->validated()['email']); $message->subject('Reset Password'); }); - return back()->with('message', 'Your password reset link has been sent to your email.'); - - }catch(\Exception $e){ - + return back()->with('message', $e->getMessage()); } } public function showNewPasswordForm(string $token){ - return view('backend.passwordReset', ['token'=> $token]); + return view('backend.password-reset', ['token'=> $token]); } - public function submitResetPasswordForm(ResetPasswordValidator $request){ + public function submitAdminNewPassword(ResetPasswordRequest $request){ try{ $tokenData = DB::table('password_reset_tokens')->where('token', $request->validated()['token'])->first(); - - if(!$tokenData): + if(!$tokenData){ return back()->with(['message' => 'Invalid token id!!']); - endif; - - - User::where('email', $tokenData->email)->first()->update([ + } + Admin::where('email', $tokenData->email)->first()->update([ 'password' => Hash::make($request->validated()['new-password']), ]); - DB::table('password_reset_tokens')->where('email', $tokenData->email)->delete(); - - return redirect()->route('login')->with('message', 'Password successfully updated!!'); + return redirect()->route('admin.login')->with('message', 'Password successfully updated!!'); }catch(\Exception $e){ - // dd($e); + return $e->getMessage(); } } - - - - - } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php new file mode 100644 index 0000000..698799a --- /dev/null +++ b/app/Http/Controllers/UserController.php @@ -0,0 +1,59 @@ +previous()); + return view('userend.login'); + } + + + //User Registration module + public function registerUser(RegisterUserRequest $request){ + try{ + User::create([ + 'name' => $request->name, + 'username' => $request->username, + 'email' => $request->email, + 'password' => $request->password, + ]); + return redirect()->back()->with('message', 'User Registered.'); + }catch(\Exception $e){ + return redirect()->back()->with('message', $e->getMessage()); + } + } + + //User Login module + public function loginUser(LoginRequest $request){ + try{ + if(Auth::guard('web')->attempt(['username' => $request->username, 'password' => $request->password])){ + return redirect()->intended(); + } + return redirect()->back()->with('message', 'Invalid Credentials'); + + }catch(\Exception $e){ + return redirect()->back()->with('message', $e->getMessage()); + } + } + + //User logout module + public function logoutUser(){ + Auth::guard('web')->logout(); + return redirect()->back(); + } + + public function index(){ + return view('userend.index'); + } +} diff --git a/app/Http/Controllers/UserPasswordResetController.php b/app/Http/Controllers/UserPasswordResetController.php new file mode 100644 index 0000000..03250d5 --- /dev/null +++ b/app/Http/Controllers/UserPasswordResetController.php @@ -0,0 +1,64 @@ +insert([ + 'email' => $request->validated()['email'], + 'token' => $token, + "created_at" => Carbon::now(), + ]); + Mail::send('userend.reset-password-link', ['token' => $token], function($message) use($request){ + $message->to($request->validated()['email']); + $message->subject('Reset Password'); + }); + return back()->with('message', 'Your password reset link has been sent to your email.'); + }catch(\Exception $e){ + return back()->with('message', $e->getMessage()); + } + } + + public function showNewPasswordForm(string $token){ + return view('userend.password-reset', ['token'=> $token]); + } + + + public function submitNewPassword(ResetPasswordRequest $request){ + try{ + $tokenData = DB::table('password_reset_tokens')->where('token', $request->validated()['token'])->first(); + if(!$tokenData){ + return back()->with(['message' => 'Invalid token id!!']); + } + User::where('email', $tokenData->email)->first()->update([ + 'password' => Hash::make($request->validated()['new-password']), + ]); + DB::table('password_reset_tokens')->where('email', $tokenData->email)->delete(); + return redirect()->route('user.login')->with('message', 'Password successfully updated!!'); + }catch(\Exception $e){ + return $e->getMessage(); + } + } + +} diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 3829a85..583074b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -66,6 +66,12 @@ class Kernel extends HttpKernel 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, ]; + protected $routeMiddleware = [ + 'guest.authenticate' => \App\Http\Middleware\GuestAuthenticate::class, + 'loginPage.auth' => \App\Http\Middleware\LoginPageAuthenticate::class, + ]; + + } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index d4ef644..9e66051 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -12,6 +12,6 @@ class Authenticate extends Middleware */ protected function redirectTo(Request $request): ?string { - return $request->expectsJson() ? null : route('login'); + return $request->expectsJson() ? null : route('admin.login'); } } diff --git a/app/Http/Middleware/GuestAuthenticate.php b/app/Http/Middleware/GuestAuthenticate.php new file mode 100644 index 0000000..c3b410c --- /dev/null +++ b/app/Http/Middleware/GuestAuthenticate.php @@ -0,0 +1,25 @@ +check()){ + return redirect('/login'); + } + return $next($request); + } +} diff --git a/app/Http/Middleware/LoginPageAuthenticate.php b/app/Http/Middleware/LoginPageAuthenticate.php new file mode 100644 index 0000000..0eddb45 --- /dev/null +++ b/app/Http/Middleware/LoginPageAuthenticate.php @@ -0,0 +1,24 @@ +check()){ + return redirect('/home'); + } + return $next($request); + } +} diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index afc78c4..ff1194a 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -27,4 +27,9 @@ public function handle(Request $request, Closure $next, string ...$guards): Resp return $next($request); } + + // app/Http/Middleware/RedirectIfAuthenticated.php + + + } diff --git a/app/Http/Requests/CategoryFormValidator.php b/app/Http/Requests/CategoryRequest.php similarity index 92% rename from app/Http/Requests/CategoryFormValidator.php rename to app/Http/Requests/CategoryRequest.php index 78f4a2c..7f80baf 100644 --- a/app/Http/Requests/CategoryFormValidator.php +++ b/app/Http/Requests/CategoryRequest.php @@ -4,7 +4,7 @@ use Illuminate\Foundation\Http\FormRequest; -class CategoryFormValidator extends FormRequest +class CategoryRequest extends FormRequest { /** * Determine if the user is authorized to make this request. diff --git a/app/Http/Requests/ForgotPasswordMailValidator.php b/app/Http/Requests/ForgotPasswordRequest.php similarity index 91% rename from app/Http/Requests/ForgotPasswordMailValidator.php rename to app/Http/Requests/ForgotPasswordRequest.php index 6784dc8..d7a65b6 100644 --- a/app/Http/Requests/ForgotPasswordMailValidator.php +++ b/app/Http/Requests/ForgotPasswordRequest.php @@ -4,7 +4,7 @@ use Illuminate\Foundation\Http\FormRequest; -class ForgotPasswordMailValidator extends FormRequest +class ForgotPasswordRequest extends FormRequest { /** * Determine if the user is authorized to make this request. diff --git a/app/Http/Requests/LoginFormValidator.php b/app/Http/Requests/LoginRequest.php similarity index 92% rename from app/Http/Requests/LoginFormValidator.php rename to app/Http/Requests/LoginRequest.php index 7a5c929..9040604 100644 --- a/app/Http/Requests/LoginFormValidator.php +++ b/app/Http/Requests/LoginRequest.php @@ -4,7 +4,7 @@ use Illuminate\Foundation\Http\FormRequest; -class LoginFormValidator extends FormRequest +class LoginRequest extends FormRequest { /** * Determine if the user is authorized to make this request. diff --git a/app/Http/Requests/RegisterUserRequest.php b/app/Http/Requests/RegisterUserRequest.php new file mode 100644 index 0000000..cccbccc --- /dev/null +++ b/app/Http/Requests/RegisterUserRequest.php @@ -0,0 +1,32 @@ +|string> + */ + public function rules(): array + { + return [ + 'name' => ['bail','required'], + 'username' => ['required', 'unique:users'], + 'email' => ['required', 'email', 'unique:users'], + 'password' => ['required'], + 'confirm_password' => ['required', 'same:password'], + ]; + } +} diff --git a/app/Http/Requests/ResetPasswordValidator.php b/app/Http/Requests/ResetPasswordRequest.php similarity index 93% rename from app/Http/Requests/ResetPasswordValidator.php rename to app/Http/Requests/ResetPasswordRequest.php index df4ea45..0fdd7bb 100644 --- a/app/Http/Requests/ResetPasswordValidator.php +++ b/app/Http/Requests/ResetPasswordRequest.php @@ -4,7 +4,7 @@ use Illuminate\Foundation\Http\FormRequest; -class ResetPasswordValidator extends FormRequest +class ResetPasswordRequest extends FormRequest { /** * Determine if the user is authorized to make this request. diff --git a/app/Models/Admin.php b/app/Models/Admin.php new file mode 100644 index 0000000..d2b95eb --- /dev/null +++ b/app/Models/Admin.php @@ -0,0 +1,48 @@ + + */ + protected $table = 'admins'; + protected $fillable = [ + 'name', + 'username', + 'email', + 'password', + ]; + + /** + * The attributes that should be hidden for serialization. + * + * @var array + */ + protected $hidden = [ + 'password', + 'remember_token', + ]; + + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'email_verified_at' => 'datetime', + 'password' => 'hashed', + ]; + +} diff --git a/app/Models/User.php b/app/Models/User.php index 4d7f70f..ce356a8 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -17,8 +17,10 @@ class User extends Authenticatable * * @var array */ + protected $table = 'users'; protected $fillable = [ 'name', + 'username', 'email', 'password', ]; @@ -42,4 +44,5 @@ class User extends Authenticatable 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; + } diff --git a/config/auth.php b/config/auth.php index 9548c15..b9873a0 100644 --- a/config/auth.php +++ b/config/auth.php @@ -40,6 +40,11 @@ 'driver' => 'session', 'provider' => 'users', ], + + 'admin' => [ + 'driver' => 'session', + 'provider' => 'admins', + ], ], /* @@ -69,6 +74,11 @@ // 'driver' => 'database', // 'table' => 'users', // ], + + 'admins' => [ + 'driver' => 'eloquent', + 'model' => App\Models\Admin::class, + ], ], /* @@ -97,6 +107,13 @@ 'expire' => 60, 'throttle' => 60, ], + + 'admins' => [ + 'provider' => 'admins', + 'table' => 'password_reset_tokens', + 'expire' => 60, + 'throttle' => 60, + ], ], /* diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 519d3ee..02b919f 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -13,6 +13,7 @@ public function up(): void { Schema::create('users', function (Blueprint $table) { $table->id(); + $table->string('name'); $table->string('username')->unique(); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); diff --git a/database/migrations/2023_12_11_045738_create_admin_data_details_table.php b/database/migrations/2024_01_08_234553_create_admins_table.php similarity index 53% rename from database/migrations/2023_12_11_045738_create_admin_data_details_table.php rename to database/migrations/2024_01_08_234553_create_admins_table.php index 7e1e554..0164dfa 100644 --- a/database/migrations/2023_12_11_045738_create_admin_data_details_table.php +++ b/database/migrations/2024_01_08_234553_create_admins_table.php @@ -11,10 +11,14 @@ */ public function up(): void { - Schema::create('admin_data_details', function (Blueprint $table) { + Schema::create('admins', function (Blueprint $table) { $table->id(); - $table->string('admin_username')->unique(); - $table->string('admin_password'); + $table->string('name'); + $table->string('username')->unique(); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); $table->timestamps(); }); } @@ -24,6 +28,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('admin_data_details'); + Schema::dropIfExists('admins'); } }; diff --git a/database/seeders/AdminDataDetails.php b/database/seeders/UserSeeder.php similarity index 62% rename from database/seeders/AdminDataDetails.php rename to database/seeders/UserSeeder.php index f9d047d..b7bfaea 100644 --- a/database/seeders/AdminDataDetails.php +++ b/database/seeders/UserSeeder.php @@ -9,7 +9,7 @@ use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; -class AdminDataDetails extends Seeder +class UserSeeder extends Seeder { /** @@ -17,13 +17,23 @@ class AdminDataDetails extends Seeder */ public function run(): void { - DB::table('users')->insert([ + DB::table('admins')->insert([ + 'name' => 'Slymee', 'username' => 'slymee', 'email' => 'slimismurf@gmail.com', 'password' => Hash::make('slymee'), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), + ]); + DB::table('users')->insert([ + 'name' => 'MeeMee', + 'username' => 'meemee', + 'email' => 'meemee@gmail.com', + 'password' => Hash::make('meemee'), + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]); } } diff --git a/public/images/holding-phone.jpg b/public/images/holding-phone.jpg new file mode 100644 index 0000000..2742f61 Binary files /dev/null and b/public/images/holding-phone.jpg differ diff --git a/resources/css/admin-login.css b/resources/css/admin-login.css index 5d11146..8feeb3a 100644 --- a/resources/css/admin-login.css +++ b/resources/css/admin-login.css @@ -20,7 +20,7 @@ margin-right: auto; margin-left: auto; width: 60%; - height: 80%; + height: 90%; background: #f0f2ff; display: flex; justify-content: space-between; diff --git a/resources/css/nav-bar.css b/resources/css/nav-bar.css new file mode 100644 index 0000000..24f905f --- /dev/null +++ b/resources/css/nav-bar.css @@ -0,0 +1,284 @@ +@import url('https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700&display=swap'); +*{ + margin: 0; + padding: 0; + outline: none; + box-sizing: border-box; + font-family: 'Montserrat', sans-serif; +} +body{ + background: #f2f2f2; +} +nav{ + background: #171c24; + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + height: 70px; + padding: 0 100px; +} +nav .logo{ + color: #fff; + font-size: 30px; + font-weight: 600; + letter-spacing: -1px; +} +nav .nav-items{ + display: flex; + flex: 1; + padding: 0 0 0 40px; +} +nav .nav-items li{ + list-style: none; + padding: 0 15px; +} +nav .nav-items li a{ + color: #fff; + font-size: 18px; + font-weight: 500; + text-decoration: none; +} +nav .nav-items li a:hover{ + color: #ff3d00; +} +nav form{ + display: flex; + height: 40px; + padding: 2px; + background: #1e232b; + min-width: 18%!important; + border-radius: 2px; + border: 1px solid rgba(155,155,155,0.2); +} +nav form .search-data{ + width: 100%; + height: 100%; + padding: 0 10px; + color: #fff; + font-size: 17px; + border: none; + font-weight: 500; + background: none; +} +nav form button{ + padding: 0 15px; + color: #fff; + font-size: 17px; + background: #ff3d00; + border: none; + border-radius: 2px; + cursor: pointer; +} +nav form button:hover{ + background: #e63600; +} +nav .menu-icon, +nav .cancel-icon, +nav .search-icon{ + width: 40px; + text-align: center; + margin: 0 50px; + font-size: 18px; + color: #fff; + cursor: pointer; + display: none; +} +nav .menu-icon span, +nav .cancel-icon, +nav .search-icon{ + display: none; +} +@media (max-width: 1245px) { + nav{ + padding: 0 50px; + } +} +@media (max-width: 1140px){ + nav{ + padding: 0px; + } + nav .logo{ + flex: 2; + text-align: center; + } + nav .nav-items{ + position: fixed; + z-index: 99; + top: 70px; + width: 100%; + left: -100%; + height: 100%; + padding: 10px 50px 0 50px; + text-align: center; + background: #14181f; + display: inline-block; + transition: left 0.3s ease; + } + nav .nav-items.active{ + left: 0px; + } + nav .nav-items li{ + line-height: 40px; + margin: 30px 0; + } + nav .nav-items li a{ + font-size: 20px; + } + nav form{ + position: absolute; + top: 80px; + right: 50px; + opacity: 0; + pointer-events: none; + transition: top 0.3s ease, opacity 0.1s ease; + } + nav form.active{ + top: 95px; + opacity: 1; + pointer-events: auto; + } + nav form:before{ + position: absolute; + content: ""; + top: -13px; + right: 0px; + width: 0; + height: 0; + z-index: -1; + border: 10px solid transparent; + border-bottom-color: #1e232b; + margin: -20px 0 0; + } + nav form:after{ + position: absolute; + content: ''; + height: 60px; + padding: 2px; + background: #1e232b; + border-radius: 2px; + min-width: calc(100% + 20px); + z-index: -2; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + } + nav .menu-icon{ + display: block; + } + nav .search-icon, + nav .menu-icon span{ + display: block; + } + nav .menu-icon span.hide, + nav .search-icon.hide{ + display: none; + } + nav .cancel-icon.show{ + display: block; + } +} +.content{ + position: absolute; + top: 50%; + left: 50%; + text-align: center; + transform: translate(-50%, -50%); +} +.content header{ + font-size: 30px; + font-weight: 700; +} +.content .text{ + font-size: 30px; + font-weight: 700; +} +.space{ + margin: 10px 0; +} +nav .logo.space{ + color: red; + padding: 0 5px 0 0; +} +@media (max-width: 980px){ + nav .menu-icon, + nav .cancel-icon, + nav .search-icon{ + margin: 0 20px; + } + nav form{ + right: 30px; + } +} +@media (max-width: 350px){ + nav .menu-icon, + nav .cancel-icon, + nav .search-icon{ + margin: 0 10px; + font-size: 16px; + } +} +.content{ + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} +.content header{ + font-size: 30px; + font-weight: 700; +} +.content .text{ + font-size: 30px; + font-weight: 700; +} +.content .space{ + margin: 10px 0; +} + + +/* separate */ +/* Dropdown Button */ +.dropbtn { + background-color: #3498DB; + color: white; + padding: 5px; + font-size: 16px; + border: none; + cursor: pointer; +} + +/* Dropdown button on hover & focus */ +.dropbtn:hover, .dropbtn:focus { + background-color: #2980B9; +} + +/* The container
- needed to position the dropdown content */ +.dropdown { + position: relative; + display: inline-block; +} + +/* Dropdown Content (Hidden by Default) */ +.dropdown-content { + display: none; + position: absolute; + background-color: #0c0c0c; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + z-index: 1; +} + +/* Links inside the dropdown */ +.dropdown-content a { + color: black; + padding: 12px 16px; + text-decoration: none; + display: block; +} + +/* Change color of dropdown links on hover */ +.dropdown-content a:hover {background-color: #ddd;} + +/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */ +.show {display:block;} \ No newline at end of file diff --git a/resources/css/user-login.css b/resources/css/user-login.css new file mode 100644 index 0000000..a4cc9f3 --- /dev/null +++ b/resources/css/user-login.css @@ -0,0 +1,216 @@ +/* Google Font Link */ +@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap'); +*{ + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: "Poppins" , sans-serif; +} +body{ + min-height: 100vh; + display: flex; + align-items: center; + justify-content: center; + background: #7d2ae8; + padding: 30px; +} +.container{ + position: relative; + max-width: 850px; + width: 100%; + background: #fff; + padding: 40px 30px; + box-shadow: 0 5px 10px rgba(0,0,0,0.2); + perspective: 2700px; +} +.container .cover{ + position: absolute; + top: 0; + left: 50%; + height: 100%; + width: 50%; + z-index: 98; + transition: all 1s ease; + transform-origin: left; + transform-style: preserve-3d; +} +.container #flip:checked ~ .cover{ + transform: rotateY(-180deg); +} + .container .cover .front, + .container .cover .back{ + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; +} +.cover .back{ + transform: rotateY(180deg); + backface-visibility: hidden; +} +.container .cover::before, +.container .cover::after{ + content: ''; + position: absolute; + height: 100%; + width: 100%; + background: #7d2ae8; + opacity: 0.5; + z-index: 12; +} +.container .cover::after{ + opacity: 0.3; + transform: rotateY(180deg); + backface-visibility: hidden; +} +.container .cover img{ + position: absolute; + height: 100%; + width: 100%; + object-fit: cover; + z-index: 10; +} +.container .cover .text{ + position: absolute; + z-index: 130; + height: 100%; + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} +.cover .text .text-1, +.cover .text .text-2{ + font-size: 26px; + font-weight: 600; + color: #fff; + text-align: center; +} +.cover .text .text-2{ + font-size: 15px; + font-weight: 500; +} +.container .forms{ + height: 100%; + width: 100%; + background: #fff; +} +.container .form-content{ + display: flex; + align-items: center; + justify-content: space-between; +} +.form-content .login-form, +.form-content .signup-form{ + width: calc(100% / 2 - 25px); +} +.forms .form-content .title{ + position: relative; + font-size: 24px; + font-weight: 500; + color: #333; +} +.forms .form-content .title:before{ + content: ''; + position: absolute; + left: 0; + bottom: 0; + height: 3px; + width: 25px; + background: #7d2ae8; +} +.forms .signup-form .title:before{ + width: 20px; +} +.forms .form-content .input-boxes{ + margin-top: 30px; +} +.forms .form-content .input-box{ + display: flex; + align-items: center; + height: 50px; + width: 100%; + margin: 10px 0; + position: relative; +} +.form-content .input-box input{ + height: 100%; + width: 100%; + outline: none; + border: none; + padding: 0 30px; + font-size: 16px; + font-weight: 500; + border-bottom: 2px solid rgba(0,0,0,0.2); + transition: all 0.3s ease; +} +.form-content .input-box input:focus, +.form-content .input-box input:valid{ + border-color: #7d2ae8; +} +.form-content .input-box i{ + position: absolute; + color: #7d2ae8; + font-size: 17px; +} +.forms .form-content .text{ + font-size: 14px; + font-weight: 500; + color: #333; +} +.forms .form-content .text a{ + text-decoration: none; +} +.forms .form-content .text a:hover{ + text-decoration: underline; +} +.forms .form-content .button{ + color: #fff; + margin-top: 40px; +} +.forms .form-content .button input{ + color: #fff; + background: #7d2ae8; + border-radius: 6px; + padding: 0; + cursor: pointer; + transition: all 0.4s ease; +} +.forms .form-content .button input:hover{ + background: #5b13b9; +} +.forms .form-content label{ + color: #5b13b9; + cursor: pointer; +} +.forms .form-content label:hover{ + text-decoration: underline; +} +.forms .form-content .login-text, +.forms .form-content .sign-up-text{ + text-align: center; + margin-top: 25px; +} +.container #flip{ + display: none; +} +@media (max-width: 730px) { + .container .cover{ + display: none; + } + .form-content .login-form, + .form-content .signup-form{ + width: 100%; + } + .form-content .signup-form{ + display: none; + } + .container #flip:checked ~ .forms .signup-form{ + display: block; + } + .container #flip:checked ~ .forms .login-form{ + display: none; + } +} \ No newline at end of file diff --git a/resources/views/commonComponents/side-nav.blade.php b/resources/views/commonComponents/side-nav.blade.php index 56133de..e09eb3c 100644 --- a/resources/views/commonComponents/side-nav.blade.php +++ b/resources/views/commonComponents/side-nav.blade.php @@ -18,7 +18,7 @@
  • Logout
  • - diff --git a/resources/views/userend/commonComponents/nav-bar.blade.php b/resources/views/userend/commonComponents/nav-bar.blade.php new file mode 100644 index 0000000..bb5a03e --- /dev/null +++ b/resources/views/userend/commonComponents/nav-bar.blade.php @@ -0,0 +1,78 @@ + + + + \ No newline at end of file diff --git a/resources/views/userend/forgot-password.blade.php b/resources/views/userend/forgot-password.blade.php new file mode 100644 index 0000000..c35d7df --- /dev/null +++ b/resources/views/userend/forgot-password.blade.php @@ -0,0 +1,59 @@ +@extends('userend.layouts.login-form-template') + +@section('page-title') + Forgot Password +@endsection + +@section('content') +
    + +
    +
    + +
    + Every new friend is a
    new adventure
    + Let's get connected +
    +
    +
    + +
    + Complete miles of journey
    with one step
    + Let's get started +
    +
    +
    +
    +
    + +
    +
    +
    +@endsection \ No newline at end of file diff --git a/resources/views/userend/index.blade.php b/resources/views/userend/index.blade.php new file mode 100644 index 0000000..60b0405 --- /dev/null +++ b/resources/views/userend/index.blade.php @@ -0,0 +1,14 @@ + + + + + + + + Brand - Home + @vite(['resources/css/nav-bar.css']) + + + @include('userend.commonComponents.nav-bar') + + \ No newline at end of file diff --git a/resources/views/userend/layouts/login-form-template.blade.php b/resources/views/userend/layouts/login-form-template.blade.php new file mode 100644 index 0000000..f9b8dbd --- /dev/null +++ b/resources/views/userend/layouts/login-form-template.blade.php @@ -0,0 +1,19 @@ + + + + + @yield('page-title') + @vite('resources/css/user-login.css') + + + + + + + @yield('content') + + \ No newline at end of file diff --git a/resources/views/userend/login.blade.php b/resources/views/userend/login.blade.php new file mode 100644 index 0000000..a5215ee --- /dev/null +++ b/resources/views/userend/login.blade.php @@ -0,0 +1,110 @@ +@extends('userend.layouts.login-form-template') + +@section('page-title') + Login +@endsection + +@section('content') +
    + +
    +
    + +
    + Every new friend is a
    new adventure
    + Let's get connected +
    +
    +
    + +
    + Complete miles of journey
    with one step
    + Let's get started +
    +
    +
    +
    +
    + + +
    +
    +
    +@endsection \ No newline at end of file diff --git a/resources/views/userend/password-reset.blade.php b/resources/views/userend/password-reset.blade.php new file mode 100644 index 0000000..41458cc --- /dev/null +++ b/resources/views/userend/password-reset.blade.php @@ -0,0 +1,64 @@ +@extends('userend.layouts.login-form-template') + +@section('page-title') + Reset Password +@endsection + +@section('content') +
    + +
    +
    + +
    + Every new friend is a
    new adventure
    + Let's get connected +
    +
    +
    + +
    + Complete miles of journey
    with one step
    + Let's get started +
    +
    +
    +
    +
    + +
    +
    +
    +@endsection \ No newline at end of file diff --git a/resources/views/userend/reset-password-link.blade.php b/resources/views/userend/reset-password-link.blade.php new file mode 100644 index 0000000..58bed4c --- /dev/null +++ b/resources/views/userend/reset-password-link.blade.php @@ -0,0 +1,19 @@ + + + + + + Password Reset + + +

    Hello!

    + +

    You have requested to reset your password. Please click on the following link to reset your password:

    + + Reset Password + +

    If you did not request a password reset, please ignore this email.

    + +

    Thank you!

    + + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 795d493..68bd943 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,9 +1,11 @@ name('login'); -Route::post('/admin-validate', [AdminDataDetailsController::class, 'login']); -Route::post('/admin-logout', [AdminDataDetailsController::class, 'logout'])->name('logout'); +Route::get('admin-login', [AdminController::class, 'index'])->name('admin.login'); +Route::post('admin-validate', [AdminController::class, 'login'])->name('admin.validate'); +Route::post('admin-logout', [AdminController::class, 'logout'])->name('admin.logout'); //Admin Dsahboard routes -Route::middleware(['auth'])->group(function () { - Route::get('/dashboard', [DashboardController::class, 'index'])->name('admin.dashboard'); - // Route::get('/admin-category', [CategoryController::class, 'index'])->name('category.and.subcategory'); - // Route::get('/admin-category-add', [CategoryController::class, 'create'])->name('add.category.form'); - // Route::post('/admin-category-add/insert', [CategoryController::class, 'store'])->name('admin.insert.category'); - // Route::get('/admin-category-edit/{category_id}', [CategoryController::class, 'edit'])->name('admin.edit.category.form'); - // Route::post('/admin-category-edit/update/{category_id}', [CategoryController::class, 'update'])->name('admin.edit.category'); - // Route::get('/admin-delete-category/{category_id}', [CategoryController::class, 'destroy'])->name('admin.delete.category'); +Route::middleware(['auth:admin'])->group(function () { + Route::get('admin-dashboard', [DashboardController::class, 'index'])->name('admin.dashboard'); Route::resource('admin-category', CategoryController::class, ['except' => ['destroy']]); Route::get('admin-category/{id}/destroy', [CategoryController::class, 'destroy'])->name('admin-category.destroy'); }); + //User Routes +Route::get('login', [UserController::class, 'userLoginForm'])->middleware('loginPage.auth')->name('user.login'); +Route::post('validate', [UserController::class, 'loginUser'])->name('user.validate'); +Route::post('register-user', [UserController::class,'registerUser'])->name('user.register'); +Route::get('logout', [UserController::class, 'logoutUser'])->name('user.logout'); +Route::get('home', [UserController::class, 'index'])->name('user.home'); + + + //guest route protection +Route::middleware(['guest.authenticate'])->group(function () { + +}); - //Forgot Password Routess -Route::get('/admin-forgot-password', [PasswordResetController::class, 'index'])->name('forgot-password-view'); -Route::post('/forgot-password', [PasswordResetController::class, 'sendResetMail'])->name('admin.forgot.password'); -Route::get('/admin-password-reset/{token}', [PasswordResetController::class, 'showNewPasswordForm'])->name('password.reset'); -Route::post('/admin-password-reset', [PasswordResetController::class, 'submitNewPasswordForm']); -Route::post('/submit-new-password', [PasswordResetController::class, 'submitResetPasswordForm'])->name('admin.new.password'); + //Forgot Password Routess +Route::get('admin-forgot-password', [PasswordResetController::class, 'index'])->name('forgot-password-view'); +Route::post('admin-forgot-password', [PasswordResetController::class, 'sendResetMail'])->name('admin.forgot.password'); +Route::get('admin-password-reset/{token}', [PasswordResetController::class, 'showNewPasswordForm'])->name('password.reset'); +Route::post('admin-password-reset', [PasswordResetController::class, 'submitNewPasswordForm']); +Route::post('submit-new-password', [PasswordResetController::class, 'submitAdminNewPassword'])->name('admin.new.password'); + + + //Forgot Password Routes: User +Route::get('forgot-password', [UserPasswordResetController::class,'index'])->name('user-forgot-password-view'); +Route::post('forgot-password', [UserPasswordResetController::class,'sendResetMail'])->name('user-forgot-password'); +Route::get('password-reset/{token}', [UserPasswordResetController::class, 'showNewPasswordForm'])->name('password-reset'); +Route::post('password-reset', [UserPasswordResetController::class, 'submitNewPassword'])->name('new-password'); + + +