Skip to content

Commit

Permalink
Merge branch 'develop' into fix-draft-message
Browse files Browse the repository at this point in the history
  • Loading branch information
dnlsilva authored Feb 28, 2024
2 parents 05d9a31 + f3ee2dc commit bcbca0e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"Allow_Reactions": "Allow reactions",
"Also_send_thread_message_to_channel_behavior": "Also send thread message to channel",
"Announcement": "Announcement",
"App_users_are_not_allowed_to_log_in_directly": "App users are not allowed to log in directly.",
"Apply_Your_Certificate": "Apply your certificate",
"Are_you_sure_question_mark": "Are you sure?",
"Are_you_sure_you_want_to_delete_your_account": "Are you sure you want to delete your account?",
Expand All @@ -39,6 +40,7 @@
"Avatar_changed_successfully": "Avatar changed successfully!",
"Avatars": "Avatars",
"Away": "Away",
"Before_you_can_login": "Before you can login, your account must be manually activated by an administrator.",
"Bio": "Bio",
"Black": "Black",
"Block": "Block",
Expand Down Expand Up @@ -256,6 +258,7 @@
"Incoming_call_from": "Incoming call from",
"Inline_code": "Inline code",
"Insert_Join_Code": "Insert join code",
"Invalid_Email": "Invalid email",
"Invalid_or_expired_invite_token": "Invalid or expired invite token",
"Invalid_server_version": "The workspace you're trying to connect is using a version that's not supported by the app anymore: {{currentVersion}}.\n\nWe require version {{minVersion}}",
"Invisible": "Invisible",
Expand Down Expand Up @@ -312,6 +315,8 @@
"Logging_out": "Logging out.",
"Login": "Login",
"Login_error": "Your credentials were rejected! Please try again.",
"Login_has_been_temporarily_blocked_for_this_IP": "Login has been temporarily blocked for this IP",
"Login_has_been_temporarily_blocked_for_this_User": "Login has been temporarily blocked for this user",
"Logout": "Logout",
"Logout_failed": "Logout failed!",
"Logout_from_other_logged_in_locations": "Logout from other logged in locations",
Expand Down Expand Up @@ -600,6 +605,7 @@
"Team_not_found": "Team not found",
"Teams": "Teams",
"Terms_of_Service": " Terms of service ",
"The_maximum_number_of_users_has_been_reached": "The maximum number of users has been reached.",
"The_room_does_not_exist": "The room does not exist or you may not have access permission",
"The_user_will_be_able_to_type_in_roomName": "The user will be able to type in {{roomName}}",
"The_user_will_be_removed_from_s": "The user will be removed from {{s}}",
Expand Down Expand Up @@ -660,6 +666,7 @@
"User_joined_the_conversation": "joined the conversation",
"User_joined_the_team": "joined this team",
"User_left_this_channel": "left the channel",
"User_not_found_or": "User not found or incorrect password",
"User_sent_an_attachment": "{{user}} sent an attachment",
"Username": "Username",
"Username_or_email": "Username or email",
Expand Down
7 changes: 7 additions & 0 deletions app/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"Allow_Reactions": "Permitir reagir",
"Also_send_thread_message_to_channel_behavior": "Também enviar mensagem do tópico para o canal",
"Announcement": "Anúncio",
"App_users_are_not_allowed_to_log_in_directly": "Usuários do aplicativo não estão autorizados a fazer login diretamente.",
"Apply_Your_Certificate": "Aplicar certificado",
"Are_you_sure_question_mark": "Você tem certeza?",
"Are_you_sure_you_want_to_delete_your_account": "Tem certeza de que deseja excluir sua conta?",
Expand All @@ -38,6 +39,7 @@
"Avatar_changed_successfully": "Avatar alterado com sucesso!",
"Avatars": "Avatars",
"Away": "Ausente",
"Before_you_can_login": "Antes que você possa fazer login, sua conta precisa ser ativada manualmente por um administrador.",
"Bio": "Biografia",
"Black": "Preto",
"Block": "Bloquear",
Expand Down Expand Up @@ -252,6 +254,7 @@
"In_app_message_notifications": "Notificações de mensagens in-app",
"Incoming_call_from": "Chamada recebida de",
"Insert_Join_Code": "Insira o código para entrar na sala",
"Invalid_Email": "E-mail inválido",
"Invalid_or_expired_invite_token": "Token de convite inválido ou vencido",
"Invalid_server_version": "O servidor que você está conectando não é suportado mais por esta versão do aplicativo: {{currentVersion}}.\n\nEsta versão do aplicativo requer a versão {{minVersion}} da workspace para funcionar corretamente.",
"Invisible": "Invisível",
Expand Down Expand Up @@ -307,6 +310,8 @@
"Logging_out": "Saindo.",
"Login": "Entrar",
"Login_error": "Suas credenciais foram rejeitadas. Tente novamente por favor!",
"Login_has_been_temporarily_blocked_for_this_IP": "Login foi temporariamente bloqueado para este IP",
"Login_has_been_temporarily_blocked_for_this_User": "Login foi temporariamente bloqueado para este usuário",
"Logout": "Sair",
"Logout_failed": "Falha ao desconectar!",
"Logout_from_other_logged_in_locations": "Sair de outros locais logados",
Expand Down Expand Up @@ -588,6 +593,7 @@
"Team_not_found": "Time não encontrado",
"Teams": "Times",
"Terms_of_Service": " Termos de serviço ",
"The_maximum_number_of_users_has_been_reached": "O número máximo de usuários foi atingido.",
"The_room_does_not_exist": "A sala não existe ou você pode não ter permissão de acesso",
"The_user_will_be_able_to_type_in_roomName": "O usuário poderá digitar em {{roomName}}",
"The_user_will_be_removed_from_s": "O usuário será removido de {{s}}",
Expand Down Expand Up @@ -648,6 +654,7 @@
"User_joined_the_conversation": "entrou na conversa",
"User_joined_the_team": "entrou no time",
"User_left_this_channel": "saiu da conversa",
"User_not_found_or": "Usuário não encontrado ou senha incorreta",
"User_sent_an_attachment": "{{user}} enviou um anexo",
"Username": "Usuário",
"Username_or_email": "Usuário ou email",
Expand Down
3 changes: 2 additions & 1 deletion app/views/LoginView/UserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import sharedStyles from '../Styles';
import UGCRules from '../../containers/UserGeneratedContentRules';
import { useAppSelector } from '../../lib/hooks';
import styles from './styles';
import { handleLoginErrors } from './handleLoginErrors';

interface ISubmit {
user: string;
Expand Down Expand Up @@ -75,7 +76,7 @@ const UserForm = () => {
const user = getValues('user');
navigation.navigate('SendEmailConfirmationView', { user });
} else {
Alert.alert(I18n.t('Oops'), I18n.t('Login_error'));
Alert.alert(I18n.t('Oops'), handleLoginErrors(error?.error));
}
}
}, [error?.error, failure, getValues, navigation]);
Expand Down
35 changes: 35 additions & 0 deletions app/views/LoginView/handleLoginErrors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import i18n from '../../i18n';

// https://github.com/RocketChat/Rocket.Chat/blob/cd5cbe2ac60939d4d94a62926b43322be9168ce0/packages/web-ui-registration/src/LoginForm.tsx#L28
const LOGIN_SUBMIT_ERRORS = {
'error-user-is-not-activated': {
i18n: 'Before_you_can_login'
},
'error-app-user-is-not-allowed-to-login': {
i18n: 'App_users_are_not_allowed_to_log_in_directly'
},
'user-not-found': {
i18n: 'User_not_found_or'
},
'error-login-blocked-for-ip': {
i18n: 'Login_has_been_temporarily_blocked_for_this_IP'
},
'error-login-blocked-for-user': {
i18n: 'Login_has_been_temporarily_blocked_for_this_User'
},
'error-license-user-limit-reached': {
i18n: 'The_maximum_number_of_users_has_been_reached'
},
'error-invalid-email': {
i18n: 'Invalid_Email'
}
};

export const handleLoginErrors = (error: keyof typeof LOGIN_SUBMIT_ERRORS): string => {
const errorKey = Object.keys(LOGIN_SUBMIT_ERRORS).find(key => error.includes(key)) as keyof typeof LOGIN_SUBMIT_ERRORS;
const e = errorKey ? LOGIN_SUBMIT_ERRORS[errorKey].i18n : 'Login_error';
if (i18n.isTranslated(e)) {
return i18n.t(e);
}
return i18n.t('Login_error');
};

0 comments on commit bcbca0e

Please sign in to comment.