Skip to content

Commit

Permalink
Update login view, add email prefill logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Jan 22, 2024
1 parent 979aa55 commit d76f016
Showing 1 changed file with 42 additions and 17 deletions.
59 changes: 42 additions & 17 deletions resources/views/auth/login.blade.php
Expand Up @@ -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') }}">
Expand All @@ -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'))
Expand All @@ -27,13 +32,20 @@
<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'))
<span class="invalid-feedback">
<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>

Expand Down Expand Up @@ -64,14 +76,9 @@
</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">
{{ __('Login') }}
</button>

</div>
</div>
<button type="submit" class="btn btn-primary btn-block btn-lg font-weight-bold rounded-pill">
{{ __('Login') }}
</button>

</form>
@if(
Expand All @@ -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

0 comments on commit d76f016

Please sign in to comment.