[IMPROVEMENT] Alert verify email when enabled (#1725)

This commit is contained in:
Djorkaeff Alexandre 2020-02-17 16:24:27 -03:00 committed by GitHub
parent 6a40d4cefb
commit 270ec79450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 3 deletions

View File

@ -5,6 +5,9 @@ export default {
Accounts_EmailOrUsernamePlaceholder: {
type: 'valueAsString'
},
Accounts_EmailVerification: {
type: 'valueAsBoolean'
},
Accounts_NamePlaceholder: {
type: 'valueAsString'
},

View File

@ -450,6 +450,8 @@ export default {
Username: 'Username',
Username_or_email: 'Username or email',
Validating: 'Validating',
Verify_email_title: 'Registration Succeeded!',
Verify_email_desc: 'We have sent you an email to confirm your registration. If you do not receive an email shortly, please come back and try again.',
Video_call: 'Video call',
View_Original: 'View Original',
Voice_call: 'Voice call',

View File

@ -404,6 +404,8 @@ export default {
Username_is_empty: 'Usuário está vazio',
Username: 'Usuário',
Username_or_email: 'Usuário ou email',
Verify_email_title: 'Registrado com sucesso!',
Verify_email_desc: 'Nós lhe enviamos um e-mail para confirmar o seu registro. Se você não receber um e-mail em breve, por favor retorne e tente novamente.',
Video_call: 'Chamada de vídeo',
Voice_call: 'Chamada de voz',
Websocket_disabled: 'Websocket está desativado para esse servidor.\n{{contact}}',

View File

@ -42,6 +42,7 @@ class RegisterView extends React.Component {
loginRequest: PropTypes.func,
Site_Name: PropTypes.string,
Accounts_CustomFields: PropTypes.string,
Accounts_EmailVerification: PropTypes.bool,
theme: PropTypes.string
}
@ -119,13 +120,19 @@ class RegisterView extends React.Component {
const {
name, email, password, username, customFields
} = this.state;
const { loginRequest } = this.props;
const { loginRequest, Accounts_EmailVerification, navigation } = this.props;
try {
await RocketChat.register({
name, email, pass: password, username, ...customFields
});
if (Accounts_EmailVerification) {
await navigation.goBack();
Alert.alert(I18n.t('Verify_email_title'), I18n.t('Verify_email_desc'));
} else {
await loginRequest({ user: email, password });
}
} catch (e) {
Alert.alert(I18n.t('Oops'), e.data.error);
}
@ -267,7 +274,8 @@ class RegisterView extends React.Component {
}
const mapStateToProps = state => ({
Accounts_CustomFields: state.settings.Accounts_CustomFields
Accounts_CustomFields: state.settings.Accounts_CustomFields,
Accounts_EmailVerification: state.settings.Accounts_EmailVerification
});
const mapDispatchToProps = dispatch => ({