From af72dd3e85d3014e1491c04572071018792399cf Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Fri, 14 Feb 2020 14:02:56 -0300 Subject: [PATCH 1/3] [IMPROVEMENT] Alert verify email when enabled --- app/constants/settings.js | 3 +++ app/i18n/locales/en.js | 2 ++ app/views/RegisterView.js | 14 +++++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/constants/settings.js b/app/constants/settings.js index 74c6234f6a7..f812c5c6d54 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -5,6 +5,9 @@ export default { Accounts_EmailOrUsernamePlaceholder: { type: 'valueAsString' }, + Accounts_EmailVerification: { + type: 'valueAsBoolean' + }, Accounts_NamePlaceholder: { type: 'valueAsString' }, diff --git a/app/i18n/locales/en.js b/app/i18n/locales/en.js index f48b0f3b01c..1294e2fe9f9 100644 --- a/app/i18n/locales/en.js +++ b/app/i18n/locales/en.js @@ -450,6 +450,8 @@ export default { Username: 'Username', Username_or_email: 'Username or email', Validating: 'Validating', + Verify_email_title: 'Registration Succeded!', + 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', diff --git a/app/views/RegisterView.js b/app/views/RegisterView.js index 12e79b633bd..964b2e7853e 100644 --- a/app/views/RegisterView.js +++ b/app/views/RegisterView.js @@ -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 => ({ From b0d7107cf0fdea256934e40cb6dbea81d08246a8 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Mon, 17 Feb 2020 16:09:42 -0300 Subject: [PATCH 2/3] Update app/i18n/locales/en.js --- app/i18n/locales/en.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/i18n/locales/en.js b/app/i18n/locales/en.js index 1294e2fe9f9..d5bdfcf8759 100644 --- a/app/i18n/locales/en.js +++ b/app/i18n/locales/en.js @@ -450,7 +450,7 @@ export default { Username: 'Username', Username_or_email: 'Username or email', Validating: 'Validating', - Verify_email_title: 'Registration Succeded!', + 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', From 99ae6b9c6369bac03d93778569921d917c3ca844 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Mon, 17 Feb 2020 16:23:37 -0300 Subject: [PATCH 3/3] Add pt-BR --- app/i18n/locales/pt-BR.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/i18n/locales/pt-BR.js b/app/i18n/locales/pt-BR.js index 3a789fa902b..c1d7a95df76 100644 --- a/app/i18n/locales/pt-BR.js +++ b/app/i18n/locales/pt-BR.js @@ -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}}',