Unverified Commit 270ec794 authored by Djorkaeff Alexandre's avatar Djorkaeff Alexandre Committed by GitHub
Browse files

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

parent 6a40d4ce
......@@ -5,6 +5,9 @@ export default {
Accounts_EmailOrUsernamePlaceholder: {
type: 'valueAsString'
},
Accounts_EmailVerification: {
type: 'valueAsBoolean'
},
Accounts_NamePlaceholder: {
type: 'valueAsString'
},
......
......@@ -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',
......
......@@ -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}}',
......
......@@ -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
});
await loginRequest({ user: email, password });
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 => ({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment