Update login view, add email prefill logic

This commit is contained in:
Daniel Supernault 2024-01-22 02:03:39 -07:00
parent 979aa55135
commit d76f01685c
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -4,8 +4,12 @@
<div class="container mt-4"> <div class="container mt-4">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-lg-5"> <div class="col-lg-5">
<div class=""> <div class="card shadow-none border">
<div class="card-header bg-transparent p-3 text-center font-weight-bold h3">{{ __('Login') }}</div> <div class="card-header bg-transparent p-3">
<h4 class="font-weight-bold mb-0 text-center">
Account Login
</h4>
</div>
<div class="card-body"> <div class="card-body">
<form method="POST" action="{{ route('login') }}"> <form method="POST" action="{{ route('login') }}">
@ -14,6 +18,7 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<label for="email" class="small font-weight-bold text-muted mb-0">Email Address</label>
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" placeholder="{{__('Email')}}" required autofocus> <input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" placeholder="{{__('Email')}}" required autofocus>
@if ($errors->has('email')) @if ($errors->has('email'))
@ -27,6 +32,7 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<label for="password" class="small font-weight-bold text-muted mb-0">Password</label>
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" placeholder="{{__('Password')}}" required> <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" placeholder="{{__('Password')}}" required>
@if ($errors->has('password')) @if ($errors->has('password'))
@ -34,6 +40,12 @@
<strong>{{ $errors->first('password') }}</strong> <strong>{{ $errors->first('password') }}</strong>
</span> </span>
@endif @endif
<p class="help-text small text-right mb-0">
<a href="{{ route('password.request') }}" class="small text-muted font-weight-bold">
{{ __('Forgot Password') }}
</a>
</p>
</div> </div>
</div> </div>
@ -64,14 +76,9 @@
</div> </div>
@endif @endif
<div class="form-group row mb-4"> <button type="submit" class="btn btn-primary btn-block btn-lg font-weight-bold rounded-pill">
<div class="col-md-12"> {{ __('Login') }}
<button type="submit" class="btn btn-primary btn-block btn-lg font-weight-bold"> </button>
{{ __('Login') }}
</button>
</div>
</div>
</form> </form>
@if( @if(
@ -91,20 +98,38 @@
</form> </form>
@endif @endif
@if(config_cache('pixelfed.open_registration'))
<hr> <hr>
<p class="text-center font-weight-bold"> <p class="text-center font-weight-bold mb-0">
@if(config_cache('pixelfed.open_registration'))
<a href="/register">Register</a> <a href="/register">Register</a>
<span class="px-1">·</span>
@endif
<a href="{{ route('password.request') }}">
{{ __('Forgot Password') }}
</a>
</p> </p>
@endif
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection
@push('scripts')
<script>
document.addEventListener("DOMContentLoaded", function() {
function getQueryParam(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
const email = getQueryParam('email');
if (email) {
const emailInput = document.getElementById('email');
if (emailInput) {
emailInput.value = email;
const passwordInput = document.getElementById('password');
if (passwordInput) {
passwordInput.focus();
}
}
}
});
</script>
@endpush