1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Review and update of login auto initiation PR

For PR #3406

- Updated naming from 'redirect' to 'initate/initation'.
- Updated phpunit.xml and .env.example.complete files with the new
  option.
- Cleaned up controller logic a bit.
- Added content and design to the new initation view to not leave user
  on a blank view for a while.
- Added non-JS button to initiation view as fallback option for
  progression.
- Moved new test to it's own Test class and expanded with additional
  scenario tests for better functionality coverage.
This commit is contained in:
Dan Brown
2022-06-21 15:32:18 +01:00
parent d5ce6b680c
commit 8b211ed461
10 changed files with 153 additions and 42 deletions

View File

@@ -38,6 +38,11 @@ return [
'registration_email_domain_invalid' => 'That email domain does not have access to this application',
'register_success' => 'Thanks for signing up! You are now registered and signed in.',
// Login auto-initiation
'auto_init_starting' => 'Attempting Login',
'auto_init_starting_desc' => 'We\'re contacting your authentication system to start the login process. If there\'s no progress after 5 seconds you can try clicking the link below.',
'auto_init_start_link' => 'Proceed with authentication',
// Password Reset
'reset_password' => 'Reset Password',
'reset_password_send_instructions' => 'Enter your email below and you will be sent an email with a password reset link.',

View File

@@ -99,6 +99,9 @@ button {
fill: var(--color-primary);
}
}
.text-button.hover-underline:hover {
text-decoration: underline;
}
.button.block {
width: 100%;

View File

@@ -0,0 +1,37 @@
@extends('layouts.simple')
@section('content')
<div class="container very-small">
<div class="my-l">&nbsp;</div>
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('auth.auto_init_starting') }}</h1>
<div style="display:none">
@include('auth.parts.login-form-' . $authMethod)
</div>
<div class="grid half left-focus">
<div>
<p class="text-small">{{ trans('auth.auto_init_starting_desc') }}</p>
<p>
<button type="submit" form="login-form" class="p-none text-button hover-underline">
{{ trans('auth.auto_init_start_link') }}
</button>
</p>
</div>
<div class="text-center">
@include('common.loading-icon')
</div>
</div>
<script nonce="{{ $cspNonce }}">
window.addEventListener('load', () => document.forms['login-form'].submit());
</script>
</div>
</div>
@stop

View File

@@ -1,16 +0,0 @@
<!DOCTYPE html>
<html lang="{{ config('app.lang') }}"
dir="{{ config('app.rtl') ? 'rtl' : 'ltr' }}">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="loginredirect-wrapper" style="display:none">
@include('auth.parts.login-form-' . $authMethod)
</div>
<script nonce="{{ $cspNonce }}">
window.onload = function(){document.forms['login-form'].submit()};
</script>
</body>
</html>