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="row justify-content-center">
<div class="col-lg-5">
<div class="">
<div class="card-header bg-transparent p-3 text-center font-weight-bold h3">{{ __('Login') }}</div>
<div class="card shadow-none border">
<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">
<form method="POST" action="{{ route('login') }}">
@ -14,6 +18,7 @@
<div class="form-group row">
<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>
@if ($errors->has('email'))
@ -27,6 +32,7 @@
<div class="form-group row">
<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>
@if ($errors->has('password'))
@ -34,6 +40,12 @@
<strong>{{ $errors->first('password') }}</strong>
</span>
@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>
@ -64,15 +76,10 @@
</div>
@endif
<div class="form-group row mb-4">
<div class="col-md-12">
<button type="submit" class="btn btn-primary btn-block btn-lg font-weight-bold">
<button type="submit" class="btn btn-primary btn-block btn-lg font-weight-bold rounded-pill">
{{ __('Login') }}
</button>
</div>
</div>
</form>
@if(
(config_cache('pixelfed.open_registration') && config('remote-auth.mastodon.enabled')) ||
@ -91,20 +98,38 @@
</form>
@endif
@if(config_cache('pixelfed.open_registration'))
<hr>
<p class="text-center font-weight-bold">
@if(config_cache('pixelfed.open_registration'))
<p class="text-center font-weight-bold mb-0">
<a href="/register">Register</a>
<span class="px-1">·</span>
@endif
<a href="{{ route('password.request') }}">
{{ __('Forgot Password') }}
</a>
</p>
@endif
</div>
</div>
</div>
</div>
</div>
@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