diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ac5ae93f8..ea94a5a66 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -295,6 +295,9 @@ } } }, + "capsLockOn": { + "message": "Caps lock is on." + }, "me": { "message": "Me", "description": "The label for yourself when shown in a group member list" diff --git a/package.json b/package.json index 2cc9e40fc..a9d5b50b6 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "loki-messenger-desktop", + "name": "session-messenger-desktop", "productName": "Session Messenger", "description": "Private messaging from your desktop", "repository": "https://github.com/loki-project/loki-messenger.git", - "version": "1.0.0-beta9", + "version": "1.0.0", "license": "GPL-3.0", "author": { "name": "Loki Project", diff --git a/ts/components/session/SessionPasswordModal.tsx b/ts/components/session/SessionPasswordModal.tsx index fe626db39..2c41cb6e3 100644 --- a/ts/components/session/SessionPasswordModal.tsx +++ b/ts/components/session/SessionPasswordModal.tsx @@ -31,6 +31,13 @@ export class SessionPasswordModal extends React.Component { this.setPassword = this.setPassword.bind(this); this.closeDialog = this.closeDialog.bind(this); + + this.onKeyUp = this.onKeyUp.bind(this); + window.addEventListener('keyup', this.onKeyUp); + } + + public componentDidMount() { + setTimeout(() => $('#password-modal-input').focus(), 100); } public render() { @@ -182,4 +189,17 @@ export class SessionPasswordModal extends React.Component { this.props.onClose(); } } + + private async onKeyUp(event: any) { + const { onOk } = this.props; + const setPasswordFocussed = + $('#password-modal-input').is(':focus') || + $('#password-modal-input-confirm').is(':focus'); + + if (event.key === 'Enter' && setPasswordFocussed) { + await this.setPassword(onOk); + } + + event.preventDefault(); + } } diff --git a/ts/components/session/SessionPasswordPrompt.tsx b/ts/components/session/SessionPasswordPrompt.tsx index 4cf06c425..82984bf15 100644 --- a/ts/components/session/SessionPasswordPrompt.tsx +++ b/ts/components/session/SessionPasswordPrompt.tsx @@ -31,6 +31,10 @@ export class SessionPasswordPrompt extends React.PureComponent<{}, State> { window.addEventListener('keyup', this.onKeyUp); } + public componentDidMount() { + setTimeout(() => $('#password-prompt-input').focus(), 100); + } + public render() { const showResetElements = this.state.errorCount >= window.CONSTANTS.MAX_LOGIN_TRIES; @@ -56,7 +60,6 @@ export class SessionPasswordPrompt extends React.PureComponent<{}, State> { { this.hasPassword(); this.refreshLinkedDevice = this.refreshLinkedDevice.bind(this); + + this.onKeyUp = this.onKeyUp.bind(this); + window.addEventListener('keyup', this.onKeyUp); } public componentDidMount() { + setTimeout(() => $('#password-lock-input').focus(), 100); + window.Whisper.events.on('refreshLinkedDeviceList', async () => { setTimeout(() => { this.refreshLinkedDevice(); @@ -552,4 +557,14 @@ export class SettingsView extends React.Component { }); }); } + + private async onKeyUp(event: any) { + const lockPasswordFocussed = $('#password-lock-input').is(':focus'); + + if (event.key === 'Enter' && lockPasswordFocussed) { + await this.validatePasswordLock(); + } + + event.preventDefault(); + } }