From df0a38566bbb82e36e4bfc2ed31c8257dd4d2167 Mon Sep 17 00:00:00 2001 From: Sarthak Pranesh Date: Thu, 2 Apr 2020 02:13:49 +0530 Subject: [PATCH] [FIX] Correct message for manual approval user Registration (#1906) * [FIX] Correct message for manual approval from admin shown on Registeration * lint fix - added semicolon * Updated the translations * [FIX] Translations * i18n to match server Co-authored-by: Djorkaeff Alexandre Co-authored-by: Diego Mello --- app/constants/settings.js | 3 +++ app/i18n/locales/en.js | 4 +++- app/i18n/locales/pt-BR.js | 3 ++- app/views/RegisterView.js | 14 ++++++++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/constants/settings.js b/app/constants/settings.js index 122d38f4..5287367f 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -47,6 +47,9 @@ export default { Accounts_ShowFormLogin: { type: 'valueAsBoolean' }, + Accounts_ManuallyApproveNewUsers: { + type: 'valueAsBoolean' + }, CROWD_Enable: { type: 'valueAsBoolean' }, diff --git a/app/i18n/locales/en.js b/app/i18n/locales/en.js index 9c0807ed..c4b92596 100644 --- a/app/i18n/locales/en.js +++ b/app/i18n/locales/en.js @@ -502,6 +502,7 @@ export default { Uses_server_configuration: 'Uses server configuration', Usually_a_discussion_starts_with_a_question_like_How_do_I_upload_a_picture: 'Usually, a discussion starts with a question, like "How do I upload a picture?"', Validating: 'Validating', + Registration_Succeeded: 'Registration Succeeded!', Verify: 'Verify', 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.', @@ -557,5 +558,6 @@ export default { You_will_be_logged_out_of_this_application: 'You will be logged out of this application.', Clear: 'Clear', This_will_clear_all_your_offline_data: 'This will clear all your offline data.', - Mark_unread: 'Mark Unread' + Mark_unread: 'Mark Unread', + Wait_activation_warning: 'Before you can login, your account must be manually activated by an administrator.' }; diff --git a/app/i18n/locales/pt-BR.js b/app/i18n/locales/pt-BR.js index 5ba5a46d..78210f2d 100644 --- a/app/i18n/locales/pt-BR.js +++ b/app/i18n/locales/pt-BR.js @@ -498,5 +498,6 @@ export default { You_will_be_logged_out_of_this_application: 'Você sairá deste aplicativo.', Clear: 'Limpar', This_will_clear_all_your_offline_data: 'Isto limpará todos os seus dados offline.', - Mark_unread: 'Marcar como não Lida' + Mark_unread: 'Marcar como não Lida', + Wait_activation_warning: 'Antes que você possa fazer o login, sua conta deve ser manualmente ativada por um administrador.' }; diff --git a/app/views/RegisterView.js b/app/views/RegisterView.js index f4a3840f..28dd12a5 100644 --- a/app/views/RegisterView.js +++ b/app/views/RegisterView.js @@ -67,6 +67,7 @@ class RegisterView extends React.Component { server: PropTypes.string, Accounts_CustomFields: PropTypes.string, Accounts_EmailVerification: PropTypes.bool, + Accounts_ManuallyApproveNewUsers: PropTypes.bool, theme: PropTypes.string, Site_Name: PropTypes.string, loginRequest: PropTypes.func, @@ -127,7 +128,12 @@ class RegisterView extends React.Component { const { name, email, password, username, customFields } = this.state; - const { loginRequest, Accounts_EmailVerification, navigation } = this.props; + const { + loginRequest, + Accounts_EmailVerification, + navigation, + Accounts_ManuallyApproveNewUsers + } = this.props; try { await RocketChat.register({ @@ -136,7 +142,10 @@ class RegisterView extends React.Component { if (Accounts_EmailVerification) { await navigation.goBack(); - showErrorAlert(I18n.t('Verify_email_desc'), I18n.t('Verify_email_title')); + showErrorAlert(I18n.t('Verify_email_desc'), I18n.t('Registration_Succeeded')); + } else if (Accounts_ManuallyApproveNewUsers) { + await navigation.goBack(); + showErrorAlert(I18n.t('Wait_activation_warning'), I18n.t('Registration_Succeeded')); } else { await loginRequest({ user: email, password }); } @@ -325,6 +334,7 @@ const mapStateToProps = state => ({ CAS_login_url: state.settings.CAS_login_url, Accounts_CustomFields: state.settings.Accounts_CustomFields, Accounts_EmailVerification: state.settings.Accounts_EmailVerification, + Accounts_ManuallyApproveNewUsers: state.settings.Accounts_ManuallyApproveNewUsers, showLoginButton: getShowLoginButton(state) });