[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: { Accounts_EmailOrUsernamePlaceholder: {
type: 'valueAsString' type: 'valueAsString'
}, },
Accounts_EmailVerification: {
type: 'valueAsBoolean'
},
Accounts_NamePlaceholder: { Accounts_NamePlaceholder: {
type: 'valueAsString' type: 'valueAsString'
}, },

View File

@ -450,6 +450,8 @@ export default {
Username: 'Username', Username: 'Username',
Username_or_email: 'Username or email', Username_or_email: 'Username or email',
Validating: 'Validating', 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', Video_call: 'Video call',
View_Original: 'View Original', View_Original: 'View Original',
Voice_call: 'Voice call', Voice_call: 'Voice call',

View File

@ -404,6 +404,8 @@ export default {
Username_is_empty: 'Usuário está vazio', Username_is_empty: 'Usuário está vazio',
Username: 'Usuário', Username: 'Usuário',
Username_or_email: 'Usuário ou email', 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', Video_call: 'Chamada de vídeo',
Voice_call: 'Chamada de voz', Voice_call: 'Chamada de voz',
Websocket_disabled: 'Websocket está desativado para esse servidor.\n{{contact}}', Websocket_disabled: 'Websocket está desativado para esse servidor.\n{{contact}}',

View File

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