Updated editor re-authentication modal (#16102)

This commit is contained in:
Sanne de Vries 2023-01-11 12:39:04 +01:00 committed by GitHub
parent 9650521376
commit 48ea2a871b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 25 deletions

View File

@ -1,37 +1,37 @@
<div class="modal-content" data-test-modal="re-authenticate"> <div class="modal-content" data-test-modal="re-authenticate">
<header class="modal-header"> <form id="login" class="gh-signin" method="post" novalidate="novalidate" {{on "submit" (perform this.reauthenticateTask)}}>
<h1>Please re-authenticate</h1> <header>
</header> <h1>Are you still here?</h1>
<button type="button" class="close" title="Close" {{on "click" @close}}>{{svg-jar "close"}}<span class="hidden">Close</span></button> <p>Your authenticated session expired. Enter your password to continue where you left off.</p>
</header>
<div class="modal-body {{if this.authenticationError 'error'}}"> <div class="form-group {{if this.authenticationError 'error'}}">
<form id="login" class="login-form" method="post" novalidate="novalidate" {{on "submit" (perform this.reauthenticateTask)}}> <label for="password">Password</label>
<div class="password-wrap" {{validation-status errors=this.signup.errors property="password" hasValidated=this.signup.hasValidated}}> <span class="gh-input-icon gh-icon-lock forgotten-wrap" {{validation-status errors=this.signup.errors property="password" hasValidated=this.signup.hasValidated}}>
<input <input
type="password" type="password"
class="gh-input password" class="gh-input password"
placeholder="Password" placeholder="•••••••••••••••"
name="password" name="password"
value={{this.signup.password}} value={{this.signup.password}}
aria-label="Your password" aria-label="Your password"
{{on "input" this.setPassword}} {{on "input" this.setPassword}}
/> />
</div> </span>
</div>
<div> <GhTaskButton
<GhTaskButton @type="submit"
@type="submit" @buttonText="Sign in &rarr;"
@buttonText="Log in" @runningText="Authenticating"
@runningText="Authenticating" @showSuccess={{false}}
@showSuccess={{false}} @task={{this.reauthenticateTask}}
@task={{this.reauthenticateTask}} @class="login gh-btn gh-btn-login gh-btn-block gh-btn-icon"
@class="gh-btn gh-btn-black gh-btn-icon" style={{accent-color-background}}
/> />
</div>
</form>
{{#if this.authenticationError}} {{#if this.authenticationError}}
<p class="response">{{this.authenticationError}}</p> <p class="response">{{this.authenticationError}}</p>
{{/if}} {{/if}}
</div> </form>
</div> </div>

View File

@ -21,6 +21,14 @@ class Signin extends EmberObject.extend(ValidationEngine) {
export default class ReAuthenticateModal extends Component { export default class ReAuthenticateModal extends Component {
@service notifications; @service notifications;
@service session; @service session;
@service modals;
static modalOptions = {
className: 'fullscreen-modal-wide fullscreen-modal-action modal-reauthenticate',
ignoreBackdropClick: true,
backgroundLight: true,
backgroundBlur: true
};
@tracked authenticationError = null; @tracked authenticationError = null;

View File

@ -1,14 +1,14 @@
{{#each this.modals._stack as |modal index|}} {{#each this.modals._stack as |modal index|}}
{{#unless modal._options.omitBackdrop}} {{#unless modal._options.omitBackdrop}}
<div <div
class="epm-backdrop {{if modal.isClosing "epm-out"}}" class="epm-backdrop {{if modal._options.backgroundLight "background-light"}} {{if modal.isClosing "epm-out"}}"
tabindex="-1" tabindex="-1"
role="presentation" role="presentation"
aria-hidden="true" aria-hidden="true"
data-test-epm-backdrop="{{index}}" data-test-epm-backdrop="{{index}}"
/> />
{{/unless}} {{/unless}}
<div class="epm-modal-container"> <div class="epm-modal-container {{if modal._options.backgroundBlur "background-blur"}}">
<EpmModal @modal={{modal}} data-test-epm-modal="{{index}}" /> <EpmModal @modal={{modal}} data-test-epm-modal="{{index}}" />
</div> </div>
{{/each}} {{/each}}

View File

@ -55,6 +55,10 @@
z-index: 10000; z-index: 10000;
} }
.epm-backdrop.background-light {
background-color: var(--whitegrey-l2);
}
.epm-modal-container { .epm-modal-container {
z-index: 10000; z-index: 10000;
display: flex; display: flex;
@ -63,6 +67,10 @@
align-items: unset; align-items: unset;
} }
.epm-modal-container.background-blur {
backdrop-filter: blur(4px);
}
.epm-animating .epm-modal-container { .epm-animating .epm-modal-container {
overflow: unset; overflow: unset;
} }

View File

@ -779,4 +779,22 @@
align-items: flex-start; align-items: flex-start;
padding: 0; padding: 0;
margin-bottom: 0; margin-bottom: 0;
}
/* Re-authentication modal (cookies expired with unsaved changes in editor)
/* ---------------------------------------------------------- */
.modal-reauthenticate p {
color: var(--black);
font-size: 1.6rem;
font-weight: 400;
}
.epm-modal.modal-reauthenticate .modal-content {
padding: 48px 32px;
}
.modal-reauthenticate .gh-signin .gh-btn-login {
margin-top: 32px;
} }

View File

@ -3,7 +3,7 @@ import windowProxy from 'ghost-admin/utils/window-proxy';
import {Response} from 'miragejs'; import {Response} from 'miragejs';
import {afterEach, beforeEach, describe, it} from 'mocha'; import {afterEach, beforeEach, describe, it} from 'mocha';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support'; import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {click, currentRouteName, currentURL, fillIn, findAll, triggerKeyEvent, visit, waitFor} from '@ember/test-helpers'; import {currentRouteName, currentURL, fillIn, findAll, triggerKeyEvent, visit, waitFor} from '@ember/test-helpers';
import {expect} from 'chai'; import {expect} from 'chai';
import {run} from '@ember/runloop'; import {run} from '@ember/runloop';
import {setupApplicationTest} from 'ember-mocha'; import {setupApplicationTest} from 'ember-mocha';
@ -175,7 +175,7 @@ describe('Acceptance: Authentication', function () {
await waitFor('[data-test-modal="re-authenticate"]', {timeout: 100}); await waitFor('[data-test-modal="re-authenticate"]', {timeout: 100});
// close the modal so the modal promise is settled and we can continue // close the modal so the modal promise is settled and we can continue
await click('[data-test-modal="re-authenticate"] button[title="Close"]'); await triggerKeyEvent('[data-test-modal="re-authenticate"]', 'keydown', 'Escape');
}); });
// don't clobber debounce/throttle for future tests // don't clobber debounce/throttle for future tests