Laravel 10 E-Commerce Project - Changing the Login and Registration Page Layout
In this video, we will learn how to change the layout of the login and registration pages.
Let's explore how to apply an HTML template to the login and registration pages.
Applying the HTML Template to the Login Page
Now, let's apply the HTML template to the login page. To do this, go to the auth directory and open the login.blade.php file.
Here, change the layout name from "app" to "base layout".
Next, open the login template page. Go to the template directory and open the login.html file in VS Code.
Now, copy the login section with the CSS and paste it inside the login.blade.php file, making the following changes:
@extends('layouts.base')
@section('content')
<style>
input [type="text"]:focus,
[type="email"]:focus,
[type="url"]:focus,
[type="password"]:focus,
[type="number"]:focus,
[type="date"]:focus,
[type="datetime-local"]:focus,
[type="month"]:focus,
[type="search"]:focus,
[type="tel"]:focus,
[type="time"]:focus,
[type="week"]:focus,
[multiple]:focus,
textarea:focus,
select:focus {
--tw-ring-color: transparent !important;
border-color: transparent !important;
}
input [type="text"]:hover,
[type="email"]:hover,
[type="url"]:hover,
[type="password"]:hover,
[type="number"]:hover,
[type="date"]:hover,
[type="datetime-local"]:hover,
[type="month"]:hover,
[type="search"]:hover,
[type="tel"]:hover,
[type="time"]:hover,
[type="week"]:hover,
[multiple]:hover,
textarea:hover,
select:hover {
--tw-ring-color: transparent !important;
border-color: transparent !important;
}
input [type="text"]:active,
[type="email"]:active,
[type="url"]:active,
[type="password"]:active,
[type="number"]:active,
[type="date"]:active,
[type="datetime-local"]:active,
[type="month"]:active,
[type="search"]:active,
[type="tel"]:active,
[type="time"]:active,
[type="week"]:active,
[multiple]:active,
textarea:active,
select:active {
--tw-ring-color: transparent !important;
border-color: transparent !important;
}
</style>
<!-- Log In Section Start -->
<div class="login-section">
<div class="materialContainer">
<div class="box">
<form method="POST" action="{{route('login')}}">
@csrf
<div class="login-title">
<h2>Login</h2>
</div>
<div class="input">
<label for="name">Username</label>
<input type="email" id="name" name="email" :value="old('email')" required="" autofocus="" autocomplete="name">
@error('email') <span class="text-danger mt-3">{{$message}}</span> @enderror
</div>
<div class="input">
<label for="pass">Password</label>
<input type="password" id="pass" class="block mt-1 w-full" name="password" required="" autocomplete="current-password">
@error('password') <span class="text-danger mt-3">{{$message}}</span> @enderror
</div>
<a href="javascript:void(0)" class="pass-forgot">Forgot your password?</a>
<div class="button login">
<button type="submit">
<span>Log In</span>
<i class="fa fa-check"></i>
</button>
</div>
<p>Not a member? <a href="{{route('register')}}" class="theme-color">Sign up now</a></p>
</form>
</div>
</div>
</div>
<!-- Log In Section End -->
@endsection
Applying the HTML Template to the Registration Page
Now, let's change the layout of the registration page. To do this, open the register.blade.php file from the auth directory and paste the content from the template file register.html file.
Make the following changes:
@extends('layouts.base')
@section('content')
<style>
[type="text"]:focus,
[type="email"]:focus,
[type="url"]:focus,
[type="password"]:focus,
[type="number"]:focus,
[type="date"]:focus,
[type="datetime-local"]:focus,
[type="month"]:focus,
[type="search"]:focus,
[type="tel"]:focus,
[type="time"]:focus,
[type="week"]:focus,
[multiple]:focus,
textarea:focus,
select:focus {
box-shadow: none !important;
border-color: transparent !important;
}
</style>
<!-- Sign Up Section Start -->
<div class="login-section">
<div class="materialContainer">
<div class="box">
<form method="POST" action="{{route('register')}}">
@csrf
<div class="login-title">
<h2>Register</h2>
</div>
<div class="input">
<label for="name">Name</label>
<input type="text" id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required="" autofocus="" autocomplete="name">
@error('name') <span class="text-danger mt-3">{{$message}} </span> @enderror
</div>
<div class="input">
<label for="emailname">Email Address</label>
<input type="email" id="emailname" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required="" autocomplete="username">
@error('email') <span class="text-danger mt-3">{{$message}} </span> @enderror
</div>
<div class="input">
<label for="pass">Password</label>
<input type="password" id="pass" class="block mt-1 w-full" name="password" required="" autocomplete="new-password">
@error('password') <span class="text-danger mt-3">{{$message}} </span> @enderror
</div>
<div class="input">
<label for="compass">Confirm Password</label>
<input type="password" id="compass" class="block mt-1 w-full" name="password_confirmation" required="" autocomplete="new-password">
</div>
<div class="button login">
<button type="submit">
<span>Sign Up</span>
<i class="fa fa-check"></i>
</button>
</div>
</form>
</div>
<p><a href="{{route('login')}}" class="theme-color">Already have an account?</a></p>
</div>
</div>
<!-- Sign Up Section End -->
@endsection
Now, save all the changes and let's check. Go to the login and registration URLs, and you will see the login and registration pages with the new template.
In this way, you can apply change the login and registration page layout.