|
|
|
@ -217,11 +217,11 @@ export class RegistrationTabs extends React.Component<{}, State> {
|
|
|
|
|
|
|
|
|
|
private onDisplayNameChanged(val: string) {
|
|
|
|
|
const sanitizedName = this.sanitiseNameInput(val);
|
|
|
|
|
const trimName = sanitizedName.trim();
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
displayName: sanitizedName,
|
|
|
|
|
displayNameError: !sanitizedName
|
|
|
|
|
? window.i18n('displayNameEmpty')
|
|
|
|
|
: undefined,
|
|
|
|
|
displayNameError: !trimName ? window.i18n('displayNameEmpty') : undefined,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -553,10 +553,7 @@ export class RegistrationTabs extends React.Component<{}, State> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private renderTermsConditionAgreement() {
|
|
|
|
|
// FIXME
|
|
|
|
|
window.log.info(
|
|
|
|
|
'FIXME: add link to our Terms and Conditions and privacy statement'
|
|
|
|
|
);
|
|
|
|
|
// FIXME add link to our Terms and Conditions and privacy statement
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="session-terms-conditions-agreement">
|
|
|
|
@ -713,7 +710,7 @@ export class RegistrationTabs extends React.Component<{}, State> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private sanitiseNameInput(val: string) {
|
|
|
|
|
return val.trim().replace(window.displayNameRegex, '');
|
|
|
|
|
return val.replace(window.displayNameRegex, '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async resetRegistration() {
|
|
|
|
@ -738,6 +735,19 @@ export class RegistrationTabs extends React.Component<{}, State> {
|
|
|
|
|
passwordFieldsMatch,
|
|
|
|
|
} = this.state;
|
|
|
|
|
// Make sure the password is valid
|
|
|
|
|
|
|
|
|
|
const trimName = displayName.trim();
|
|
|
|
|
|
|
|
|
|
if (!trimName) {
|
|
|
|
|
window.pushToast({
|
|
|
|
|
title: window.i18n('displayNameEmpty'),
|
|
|
|
|
type: 'error',
|
|
|
|
|
id: 'invalidDisplayName',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (passwordErrorString) {
|
|
|
|
|
window.pushToast({
|
|
|
|
|
title: window.i18n('invalidPassword'),
|
|
|
|
@ -761,9 +771,6 @@ export class RegistrationTabs extends React.Component<{}, State> {
|
|
|
|
|
if (!mnemonicSeed) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!displayName) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Ensure we clear the secondary device registration status
|
|
|
|
|
window.textsecure.storage.remove('secondaryDeviceStatus');
|
|
|
|
@ -775,7 +782,7 @@ export class RegistrationTabs extends React.Component<{}, State> {
|
|
|
|
|
await this.accountManager.registerSingleDevice(
|
|
|
|
|
mnemonicSeed,
|
|
|
|
|
language,
|
|
|
|
|
displayName
|
|
|
|
|
trimName
|
|
|
|
|
);
|
|
|
|
|
trigger('openInbox');
|
|
|
|
|
} catch (e) {
|
|
|
|
|