Revert fancy code

pull/1035/head
Vincent 6 years ago
parent 9349ebd37a
commit 5eec031803

@ -44,7 +44,11 @@ export class SessionPasswordModal extends React.Component<Props, State> {
public componentDidMount() { public componentDidMount() {
setTimeout(() => { setTimeout(() => {
this.passwordInput.current?.focus(); if (!this.passwordInput.current) {
return;
}
this.passwordInput.current.focus();
}, 100); }, 100);
} }
@ -136,10 +140,14 @@ export class SessionPasswordModal extends React.Component<Props, State> {
} }
private async setPassword(onSuccess: any) { private async setPassword(onSuccess: any) {
if (!this.passwordInput.current || !this.passwordInputConfirm.current){
return;
}
// Trim leading / trailing whitespace for UX // Trim leading / trailing whitespace for UX
const enteredPassword = String(this.passwordInput.current?.value).trim(); const enteredPassword = String(this.passwordInput.current.value).trim();
const enteredPasswordConfirm = String( const enteredPasswordConfirm = String(
this.passwordInputConfirm.current?.value this.passwordInputConfirm.current.value
).trim(); ).trim();
if (enteredPassword.length === 0 || enteredPasswordConfirm.length === 0) { if (enteredPassword.length === 0 || enteredPasswordConfirm.length === 0) {

Loading…
Cancel
Save