mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-7: Refactoring entry point and web to use translations (chunk 8)
- Add spanish translations
This commit is contained in:
280
i18n/en.json
280
i18n/en.json
@@ -1671,10 +1671,50 @@
|
||||
"id": "manaultesting.test_autolink.unable.app_error",
|
||||
"translation": "Unable to get channels"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.bulletin.subject",
|
||||
"translation": "Mattermost Security Bulletin"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.config_file",
|
||||
"translation": "Loaded config file from %v"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.current_version",
|
||||
"translation": "Current version is %v (%v/%v/%v)"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.entreprise_enabled",
|
||||
"translation": "Enterprise Enabled: %v"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.security_bulletin.error",
|
||||
"translation": "Failed to get security bulletin details"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.security_bulletin_read.error",
|
||||
"translation": "Failed to read security bulletin details"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.security_checks.debug",
|
||||
"translation": "Checking for security update from Mattermost"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.security_info.error",
|
||||
"translation": "Failed to get security update information from Mattermost."
|
||||
},
|
||||
{
|
||||
"id": "mattermost.send_bulletin.info",
|
||||
"translation": "Sending security bulletin for %v to %v"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.system_admins.error",
|
||||
"translation": "Failed to get system admins for security update information from Mattermost."
|
||||
},
|
||||
{
|
||||
"id": "mattermost.working_dir",
|
||||
"translation": "Current working directory is %v"
|
||||
},
|
||||
{
|
||||
"id": "model.access.is_valid.access_token.app_error",
|
||||
"translation": "Invalid access token"
|
||||
@@ -3094,5 +3134,245 @@
|
||||
{
|
||||
"id": "utils.mail.test.configured.error",
|
||||
"translation": "SMTP server settings do not appear to be configured properly err=%v details=%v"
|
||||
},
|
||||
{
|
||||
"id": "web.admin_console.title",
|
||||
"translation": "Admin Console"
|
||||
},
|
||||
{
|
||||
"id": "web.authorize_oauth.disabled.app_error",
|
||||
"translation": "The system admin has turned off OAuth service providing."
|
||||
},
|
||||
{
|
||||
"id": "web.authorize_oauth.missing.app_error",
|
||||
"translation": "Missing one or more of response_type, client_id, or redirect_uri"
|
||||
},
|
||||
{
|
||||
"id": "web.authorize_oauth.title",
|
||||
"translation": "Authorize Application"
|
||||
},
|
||||
{
|
||||
"id": "web.check_browser_compatibility.app_error",
|
||||
"translation": "Your current browser is not supported, please upgrade to one of the following browsers: Google Chrome 21 or higher, Internet Explorer 11 or higher, FireFox 14 or higher, Safari 9 or higher"
|
||||
},
|
||||
{
|
||||
"id": "web.claim_account.team.error",
|
||||
"translation": "Couldn't find team name=%v, err=%v"
|
||||
},
|
||||
{
|
||||
"id": "web.claim_account.title",
|
||||
"translation": "Claim Account"
|
||||
},
|
||||
{
|
||||
"id": "web.claim_account.user.error",
|
||||
"translation": "Couldn't find user teamid=%v, email=%v, err=%v"
|
||||
},
|
||||
{
|
||||
"id": "web.create_dir.error",
|
||||
"translation": "Failed to create directory watcher %v"
|
||||
},
|
||||
{
|
||||
"id": "web.dir_fail.error",
|
||||
"translation": "Failed in directory watcher %v"
|
||||
},
|
||||
{
|
||||
"id": "web.do_load_channel.error",
|
||||
"translation": "Error in getting users profile for id=%v forcing logout"
|
||||
},
|
||||
{
|
||||
"id": "web.doc.title",
|
||||
"translation": "Documentation"
|
||||
},
|
||||
{
|
||||
"id": "web.email_verified.title",
|
||||
"translation": "Email Verified"
|
||||
},
|
||||
{
|
||||
"id": "web.find_team.title",
|
||||
"translation": "Find Team"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.bad_client_id.app_error",
|
||||
"translation": "invalid_request: Bad client_id"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.bad_client_secret.app_error",
|
||||
"translation": "invalid_request: Missing client_secret"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.bad_grant.app_error",
|
||||
"translation": "invalid_request: Bad grant_type"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.credentials.app_error",
|
||||
"translation": "invalid_client: Invalid client credentials"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.disabled.app_error",
|
||||
"translation": "The system admin has turned off OAuth service providing."
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.exchanged.app_error",
|
||||
"translation": "invalid_grant: Authorization code already exchanged for an access token"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.expired_code.app_error",
|
||||
"translation": "invalid_grant: Invalid or expired authorization code"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.internal.app_error",
|
||||
"translation": "server_error: Encountered internal server error while accessing database"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.internal_saving.app_error",
|
||||
"translation": "server_error: Encountered internal server error while saving access token to database"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.internal_session.app_error",
|
||||
"translation": "server_error: Encountered internal server error while saving session to database"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.internal_user.app_error",
|
||||
"translation": "server_error: Encountered internal server error while pulling user from database"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.missing_code.app_error",
|
||||
"translation": "invalid_request: Missing code"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.redirect_uri.app_error",
|
||||
"translation": "invalid_request: Supplied redirect_uri does not match authorization code redirect_uri"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.revoking.error",
|
||||
"translation": "Encountered an error revoking an access token, err="
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.channel.app_error",
|
||||
"translation": "Couldn't find the channel"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.disabled.app_error",
|
||||
"translation": "Incoming webhooks have been disabled by the system admin."
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.invalid.app_error",
|
||||
"translation": "Invalid webhook"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.parse.app_error",
|
||||
"translation": "Unable to parse incoming data"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.permissions.app_error",
|
||||
"translation": "Inappropriate channel permissions"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.text.app_error",
|
||||
"translation": "No text specified"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.user.app_error",
|
||||
"translation": "Couldn't find the user"
|
||||
},
|
||||
{
|
||||
"id": "web.init.debug",
|
||||
"translation": "Initializing web routes"
|
||||
},
|
||||
{
|
||||
"id": "web.login.error",
|
||||
"translation": "Couldn't find team name=%v, err=%v"
|
||||
},
|
||||
{
|
||||
"id": "web.login.login_title",
|
||||
"translation": "Login"
|
||||
},
|
||||
{
|
||||
"id": "web.login_with_oauth.invalid_team.app_error",
|
||||
"translation": "Invalid team name"
|
||||
},
|
||||
{
|
||||
"id": "web.parsing_templates.debug",
|
||||
"translation": "Parsing templates at %v"
|
||||
},
|
||||
{
|
||||
"id": "web.parsing_templates.error",
|
||||
"translation": "Failed to parse templates %v"
|
||||
},
|
||||
{
|
||||
"id": "web.post_permalink.app_error",
|
||||
"translation": "Invalid Post ID"
|
||||
},
|
||||
{
|
||||
"id": "web.reparse_templates.info",
|
||||
"translation": "Re-parsing templates because of modified file %v"
|
||||
},
|
||||
{
|
||||
"id": "web.reset_password.expired_link.app_error",
|
||||
"translation": "The signup link has expired"
|
||||
},
|
||||
{
|
||||
"id": "web.reset_password.invalid_link.app_error",
|
||||
"translation": "The reset link does not appear to be valid"
|
||||
},
|
||||
{
|
||||
"id": "web.root.home_title",
|
||||
"translation": "Home"
|
||||
},
|
||||
{
|
||||
"id": "web.root.singup_title",
|
||||
"translation": "Signup"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_team_complete.invalid_link.app_error",
|
||||
"translation": "The signup link does not appear to be valid"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_team_complete.link_expired.app_error",
|
||||
"translation": "The signup link has expired"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_team_complete.title",
|
||||
"translation": "Complete Team Sign Up"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_team_confirm.title",
|
||||
"translation": "Signup Email Sent"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_user_complete.link_expired.app_error",
|
||||
"translation": "The signup link has expired"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_user_complete.link_invalid.app_error",
|
||||
"translation": "The signup link does not appear to be valid"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_user_complete.no_invites.app_error",
|
||||
"translation": "The team type doesn't allow open invites"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_user_complete.title",
|
||||
"translation": "Complete User Sign Up"
|
||||
},
|
||||
{
|
||||
"id": "web.singup_with_oauth.disabled.app_error",
|
||||
"translation": "User sign-up is disabled."
|
||||
},
|
||||
{
|
||||
"id": "web.singup_with_oauth.expired_link.app_error",
|
||||
"translation": "The signup link has expired"
|
||||
},
|
||||
{
|
||||
"id": "web.singup_with_oauth.invalid_link.app_error",
|
||||
"translation": "The signup link does not appear to be valid"
|
||||
},
|
||||
{
|
||||
"id": "web.singup_with_oauth.invalid_team.app_error",
|
||||
"translation": "Invalid team name"
|
||||
},
|
||||
{
|
||||
"id": "web.watcher_fail.error",
|
||||
"translation": "Failed to add directory to watcher %v"
|
||||
}
|
||||
]
|
||||
280
i18n/es.json
280
i18n/es.json
@@ -1671,10 +1671,50 @@
|
||||
"id": "manaultesting.test_autolink.unable.app_error",
|
||||
"translation": "No se pudo obtener los canales"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.bulletin.subject",
|
||||
"translation": "Boletín de Seguridad Mattermost"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.config_file",
|
||||
"translation": "Cargado el archivo de configuración desde %v"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.current_version",
|
||||
"translation": "La versión actual es %v (%v/%v/%v)"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.entreprise_enabled",
|
||||
"translation": "Empresa Habilitada: %v"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.security_bulletin.error",
|
||||
"translation": "Falla al obtener el detalle del boletín de seguridad"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.security_bulletin_read.error",
|
||||
"translation": "Falla al leer el detalle del boletín de seguridad"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.security_checks.debug",
|
||||
"translation": "Consultando si existen actualizaciones de seguridad para Mattermost"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.security_info.error",
|
||||
"translation": "Falla al obtener información sobre actualizaciones de seguridad para Mattermost."
|
||||
},
|
||||
{
|
||||
"id": "mattermost.send_bulletin.info",
|
||||
"translation": "Enviando boletín de seguridad para %v a %v"
|
||||
},
|
||||
{
|
||||
"id": "mattermost.system_admins.error",
|
||||
"translation": "Falla al obtener los administradores de sistema que reciben información referente a las actualizaciones de seguridade de Mattermost."
|
||||
},
|
||||
{
|
||||
"id": "mattermost.working_dir",
|
||||
"translation": "El directorio de trabajo actual es %v"
|
||||
},
|
||||
{
|
||||
"id": "model.access.is_valid.access_token.app_error",
|
||||
"translation": "Token de acceso inválido"
|
||||
@@ -3094,5 +3134,245 @@
|
||||
{
|
||||
"id": "utils.mail.test.configured.error",
|
||||
"translation": "El servidor SMTP parece no estar configurado apropiadamente err=%v details=%v"
|
||||
},
|
||||
{
|
||||
"id": "web.admin_console.title",
|
||||
"translation": "Consola de Administración"
|
||||
},
|
||||
{
|
||||
"id": "web.authorize_oauth.disabled.app_error",
|
||||
"translation": "El administrador de sistema ha desactivado el servicio de autenticación por OAuth."
|
||||
},
|
||||
{
|
||||
"id": "web.authorize_oauth.missing.app_error",
|
||||
"translation": "Falta uno o más de response_type, client_id, or redirect_uri"
|
||||
},
|
||||
{
|
||||
"id": "web.authorize_oauth.title",
|
||||
"translation": "Autorizar Aplicación"
|
||||
},
|
||||
{
|
||||
"id": "web.check_browser_compatibility.app_error",
|
||||
"translation": "Tu navegador actual no está soportado, por favor actualiza a uno de los siguientes navegadores: Google Chrome 21 o superior, Internet Explorer 11 o superior, FireFox 14 o superior, Safari 9 o superior"
|
||||
},
|
||||
{
|
||||
"id": "web.claim_account.team.error",
|
||||
"translation": "No se encontro el equipo con nombre=%v, err=%v"
|
||||
},
|
||||
{
|
||||
"id": "web.claim_account.title",
|
||||
"translation": "Reclamar cuenta"
|
||||
},
|
||||
{
|
||||
"id": "web.claim_account.user.error",
|
||||
"translation": "No se encotró el usuario teamid=%v, email=%v, err=%v"
|
||||
},
|
||||
{
|
||||
"id": "web.create_dir.error",
|
||||
"translation": "Falla al crear el vigilante de directorio %v"
|
||||
},
|
||||
{
|
||||
"id": "web.dir_fail.error",
|
||||
"translation": "Falla al vigilar el directorio %v"
|
||||
},
|
||||
{
|
||||
"id": "web.do_load_channel.error",
|
||||
"translation": "Error obteniendo el pérfil de usuario para id=%v forzando el cierre de sesión"
|
||||
},
|
||||
{
|
||||
"id": "web.doc.title",
|
||||
"translation": "Documentación"
|
||||
},
|
||||
{
|
||||
"id": "web.email_verified.title",
|
||||
"translation": "Correo electrónico verificado"
|
||||
},
|
||||
{
|
||||
"id": "web.find_team.title",
|
||||
"translation": "Encontrar Equipo"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.bad_client_id.app_error",
|
||||
"translation": "invalid_request: client_id malo"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.bad_client_secret.app_error",
|
||||
"translation": "invalid_request: Falta client_secret"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.bad_grant.app_error",
|
||||
"translation": "invalid_request: grant_type malo"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.credentials.app_error",
|
||||
"translation": "invalid_client: credenciales inválidas de cliente"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.disabled.app_error",
|
||||
"translation": "El administrador de sistema ha desactivado el servicio de autenticación por OAuth."
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.exchanged.app_error",
|
||||
"translation": "invalid_grant: El código de autorización ya fue intercambiado por un token de acceso"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.expired_code.app_error",
|
||||
"translation": "invalid_grant: Código de autorización inválido o expirado"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.internal.app_error",
|
||||
"translation": "server_error: Se encontró un error interno al intentar de accesar la base de datos"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.internal_saving.app_error",
|
||||
"translation": "server_error: Se encontró un error interno al guardar el token de acceso en la base de datos"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.internal_session.app_error",
|
||||
"translation": "server_error: Se enconttró un error interno al guardar la sesión en la base de datos"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.internal_user.app_error",
|
||||
"translation": "server_error: Se encontró un error interno al extraer el usuario de la base de datos"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.missing_code.app_error",
|
||||
"translation": "invalid_request: Falta el código"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.redirect_uri.app_error",
|
||||
"translation": "invalid_request: El redirect_uri suministrado no coincide con el código de autorización"
|
||||
},
|
||||
{
|
||||
"id": "web.get_access_token.revoking.error",
|
||||
"translation": "Se encontró un error al revocar el acceso del token, err="
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.channel.app_error",
|
||||
"translation": "No se encontró el canal"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.disabled.app_error",
|
||||
"translation": "Webhooks entrantes han sido deshabilitados por el administrador del sistema."
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.invalid.app_error",
|
||||
"translation": "Webhook inválido"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.parse.app_error",
|
||||
"translation": "No se puede analizar la data entrante"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.permissions.app_error",
|
||||
"translation": "Permisos del canal inapropiados"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.text.app_error",
|
||||
"translation": "No se especificó un texto"
|
||||
},
|
||||
{
|
||||
"id": "web.incoming_webhook.user.app_error",
|
||||
"translation": "No se encontró el usuario"
|
||||
},
|
||||
{
|
||||
"id": "web.init.debug",
|
||||
"translation": "Inicializando rutas Web"
|
||||
},
|
||||
{
|
||||
"id": "web.login.error",
|
||||
"translation": "No se encontro el equipo con nombre=%v, err=%v"
|
||||
},
|
||||
{
|
||||
"id": "web.login.login_title",
|
||||
"translation": "Inicio de sesión"
|
||||
},
|
||||
{
|
||||
"id": "web.login_with_oauth.invalid_team.app_error",
|
||||
"translation": "Nombre del equipo inválido"
|
||||
},
|
||||
{
|
||||
"id": "web.parsing_templates.debug",
|
||||
"translation": "Analizando el contenido de las plantillas en %v"
|
||||
},
|
||||
{
|
||||
"id": "web.parsing_templates.error",
|
||||
"translation": "Falla al analizar el contenido de las plantillas %v"
|
||||
},
|
||||
{
|
||||
"id": "web.post_permalink.app_error",
|
||||
"translation": "El ID del Mensaje es inválido"
|
||||
},
|
||||
{
|
||||
"id": "web.reparse_templates.info",
|
||||
"translation": "Re-analizando el contenido de las plantillas porque el archivo %v fue modificado"
|
||||
},
|
||||
{
|
||||
"id": "web.reset_password.expired_link.app_error",
|
||||
"translation": "El enlace de registro ha expirado"
|
||||
},
|
||||
{
|
||||
"id": "web.reset_password.invalid_link.app_error",
|
||||
"translation": "El enlace para restablecer la contraseña parece ser inválido"
|
||||
},
|
||||
{
|
||||
"id": "web.root.home_title",
|
||||
"translation": "Inicio"
|
||||
},
|
||||
{
|
||||
"id": "web.root.singup_title",
|
||||
"translation": "Registrar"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_team_complete.invalid_link.app_error",
|
||||
"translation": "El enlace de registro parece ser inválido"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_team_complete.link_expired.app_error",
|
||||
"translation": "El enlace de registro ha expirado"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_team_complete.title",
|
||||
"translation": "Registro del equipo completado"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_team_confirm.title",
|
||||
"translation": "Correo de registro enviado"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_user_complete.link_expired.app_error",
|
||||
"translation": "El enlace de registro ha expirado"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_user_complete.link_invalid.app_error",
|
||||
"translation": "El enlace de registro parece ser inválido"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_user_complete.no_invites.app_error",
|
||||
"translation": "El tipo de equipo no permite realizar invitaciones"
|
||||
},
|
||||
{
|
||||
"id": "web.signup_user_complete.title",
|
||||
"translation": "Registro de usuario completado"
|
||||
},
|
||||
{
|
||||
"id": "web.singup_with_oauth.disabled.app_error",
|
||||
"translation": "El registro de usuario está deshabilitado."
|
||||
},
|
||||
{
|
||||
"id": "web.singup_with_oauth.expired_link.app_error",
|
||||
"translation": "El enlace de registro ha expirado"
|
||||
},
|
||||
{
|
||||
"id": "web.singup_with_oauth.invalid_link.app_error",
|
||||
"translation": "El enlace de registro parece ser inválido"
|
||||
},
|
||||
{
|
||||
"id": "web.singup_with_oauth.invalid_team.app_error",
|
||||
"translation": "Nombre del equipo inválido"
|
||||
},
|
||||
{
|
||||
"id": "web.watcher_fail.error",
|
||||
"translation": "Falla al agregar el directorio a ser vigilado %v"
|
||||
}
|
||||
]
|
||||
@@ -58,9 +58,9 @@ func main() {
|
||||
|
||||
pwd, _ := os.Getwd()
|
||||
l4g.Info(utils.T("mattermost.current_version"), model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash)
|
||||
l4g.Info("Enterprise Enabled: %v", model.BuildEnterpriseReady)
|
||||
l4g.Info("Current working directory is %v", pwd)
|
||||
l4g.Info("Loaded config file from %v", utils.FindConfigFile(flagConfigFile))
|
||||
l4g.Info(utils.T("mattermost.entreprise_enabled"), model.BuildEnterpriseReady)
|
||||
l4g.Info(utils.T("mattermost.working_dir"), pwd)
|
||||
l4g.Info(utils.T("mattermost.config_file"), utils.FindConfigFile(flagConfigFile))
|
||||
|
||||
api.NewServer()
|
||||
api.InitApi()
|
||||
@@ -118,7 +118,7 @@ func runSecurityAndDiagnosticsJobAndForget() {
|
||||
currentTime := model.GetMillis()
|
||||
|
||||
if (currentTime - lastSecurityTime) > 1000*60*60*24*1 {
|
||||
l4g.Debug("Checking for security update from Mattermost")
|
||||
l4g.Debug(utils.T("mattermost.security_checks.debug"))
|
||||
|
||||
v := url.Values{}
|
||||
|
||||
@@ -152,7 +152,7 @@ func runSecurityAndDiagnosticsJobAndForget() {
|
||||
|
||||
res, err := http.Get(utils.DIAGNOSTIC_URL + "/security?" + v.Encode())
|
||||
if err != nil {
|
||||
l4g.Error("Failed to get security update information from Mattermost.")
|
||||
l4g.Error(utils.T("mattermost.security_info.error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -162,27 +162,27 @@ func runSecurityAndDiagnosticsJobAndForget() {
|
||||
if bulletin.AppliesToVersion == model.CurrentVersion {
|
||||
if props["SecurityBulletin_"+bulletin.Id] == "" {
|
||||
if results := <-api.Srv.Store.User().GetSystemAdminProfiles(); results.Err != nil {
|
||||
l4g.Error("Failed to get system admins for security update information from Mattermost.")
|
||||
l4g.Error(utils.T("mattermost.system_admins.error"))
|
||||
return
|
||||
} else {
|
||||
users := results.Data.(map[string]*model.User)
|
||||
|
||||
resBody, err := http.Get(utils.DIAGNOSTIC_URL + "/bulletins/" + bulletin.Id)
|
||||
if err != nil {
|
||||
l4g.Error("Failed to get security bulletin details")
|
||||
l4g.Error(utils.T("mattermost.security_bulletin.error"))
|
||||
return
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resBody.Body)
|
||||
res.Body.Close()
|
||||
if err != nil || resBody.StatusCode != 200 {
|
||||
l4g.Error("Failed to read security bulletin details")
|
||||
l4g.Error(utils.T("mattermost.security_bulletin_read.error"))
|
||||
return
|
||||
}
|
||||
|
||||
for _, user := range users {
|
||||
l4g.Info("Sending security bulletin for " + bulletin.Id + " to " + user.Email)
|
||||
utils.SendMail(user.Email, "Mattermost Security Bulletin", string(body))
|
||||
l4g.Info(utils.T("mattermost.send_bulletin.info"), bulletin.Id, user.Email)
|
||||
utils.SendMail(user.Email, utils.T("mattermost.bulletin.subject"), string(body))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ func cmdCreateTeam() {
|
||||
|
||||
api.CreateTeam(c, team)
|
||||
if c.Err != nil {
|
||||
if c.Err.Message != "A team with that domain already exists" {
|
||||
if c.Err.Id != "store.sql_team.save.domain_exists.app_error" {
|
||||
l4g.Error("%v", c.Err)
|
||||
flushLogAndExit(1)
|
||||
}
|
||||
@@ -313,7 +313,7 @@ func cmdCreateUser() {
|
||||
|
||||
_, err := api.CreateUser(team, user)
|
||||
if err != nil {
|
||||
if err.Message != "An account with that email already exists." {
|
||||
if err.Id != "store.sql_user.save.email_exists.app_error" {
|
||||
l4g.Error("%v", err)
|
||||
flushLogAndExit(1)
|
||||
}
|
||||
|
||||
132
web/web.go
132
web/web.go
@@ -60,7 +60,7 @@ func (me *HtmlTemplatePage) Render(c *api.Context, w http.ResponseWriter) {
|
||||
}
|
||||
|
||||
func InitWeb() {
|
||||
l4g.Debug("Initializing web routes")
|
||||
l4g.Debug(utils.T("web.init.debug"))
|
||||
|
||||
mainrouter := api.Srv.Router
|
||||
|
||||
@@ -112,15 +112,15 @@ func InitWeb() {
|
||||
func watchAndParseTemplates() {
|
||||
|
||||
templatesDir := utils.FindDir("web/templates")
|
||||
l4g.Debug("Parsing templates at %v", templatesDir)
|
||||
l4g.Debug(utils.T("web.parsing_templates.debug"), templatesDir)
|
||||
var err error
|
||||
if Templates, err = template.ParseGlob(templatesDir + "*.html"); err != nil {
|
||||
l4g.Error("Failed to parse templates %v", err)
|
||||
l4g.Error(utils.T("web.parsing_templates.error"), err)
|
||||
}
|
||||
|
||||
watcher, err := fsnotify.NewWatcher()
|
||||
if err != nil {
|
||||
l4g.Error("Failed to create directory watcher %v", err)
|
||||
l4g.Error(utils.T("web.create_dir.error"), err)
|
||||
}
|
||||
|
||||
go func() {
|
||||
@@ -128,20 +128,20 @@ func watchAndParseTemplates() {
|
||||
select {
|
||||
case event := <-watcher.Events:
|
||||
if event.Op&fsnotify.Write == fsnotify.Write {
|
||||
l4g.Info("Re-parsing templates because of modified file %v", event.Name)
|
||||
l4g.Info(utils.T("web.reparse_templates.info"), event.Name)
|
||||
if Templates, err = template.ParseGlob(templatesDir + "*.html"); err != nil {
|
||||
l4g.Error("Failed to parse templates %v", err)
|
||||
l4g.Error(utils.T("web.parsing_templates.error"), err)
|
||||
}
|
||||
}
|
||||
case err := <-watcher.Errors:
|
||||
l4g.Error("Failed in directory watcher %v", err)
|
||||
l4g.Error(utils.T("web.dir_fail.error"), err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
err = watcher.Add(templatesDir)
|
||||
if err != nil {
|
||||
l4g.Error("Failed to add directory to watcher %v", err)
|
||||
l4g.Error(utils.T("web.watcher_fail.error"), err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ func CheckBrowserCompatability(c *api.Context, r *http.Request) bool {
|
||||
version := strings.Split(browser, "/")
|
||||
|
||||
if strings.HasPrefix(bname, version[0]) && strings.HasPrefix(bversion, version[1]) {
|
||||
c.Err = model.NewAppError("CheckBrowserCompatability", "Your current browser is not supported, please upgrade to one of the following browsers: Google Chrome 21 or higher, Internet Explorer 11 or higher, FireFox 14 or higher, Safari 9 or higher", "")
|
||||
c.Err = model.NewLocAppError("CheckBrowserCompatability", "web.check_browser_compatibility.app_error", nil, "")
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ func root(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if len(c.Session.UserId) == 0 {
|
||||
page := NewHtmlTemplatePage("signup_team", "Signup", c.Locale)
|
||||
page := NewHtmlTemplatePage("signup_team", c.T("web.root.singup_title"), c.Locale)
|
||||
|
||||
if result := <-api.Srv.Store.Team().GetAllTeamListing(); result.Err != nil {
|
||||
c.Err = result.Err
|
||||
@@ -211,7 +211,7 @@ func root(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
user = ur.Data.(*model.User)
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("home", "Home", c.Locale)
|
||||
page := NewHtmlTemplatePage("home", c.T("web.root.home_title"), c.Locale)
|
||||
page.Team = team
|
||||
page.User = user
|
||||
page.Render(c, w)
|
||||
@@ -224,7 +224,7 @@ func signup(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("signup_team", "Signup", c.Locale)
|
||||
page := NewHtmlTemplatePage("signup_team", c.T("web.root.singup_title"), c.Locale)
|
||||
page.Render(c, w)
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ func login(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var team *model.Team
|
||||
if tResult := <-api.Srv.Store.Team().GetByName(teamName); tResult.Err != nil {
|
||||
l4g.Error("Couldn't find team name=%v, err=%v", teamName, tResult.Err.Message)
|
||||
l4g.Error(utils.T("web.login.error"), teamName, tResult.Err.Message)
|
||||
http.Redirect(w, r, api.GetProtocol(r)+"://"+r.Host, http.StatusTemporaryRedirect)
|
||||
return
|
||||
} else {
|
||||
@@ -259,7 +259,7 @@ func login(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("login", "Login", c.Locale)
|
||||
page := NewHtmlTemplatePage("login", c.T("web.login.login_title"), c.Locale)
|
||||
page.Props["TeamDisplayName"] = team.DisplayName
|
||||
page.Props["TeamName"] = team.Name
|
||||
|
||||
@@ -273,7 +273,7 @@ func login(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
func signupTeamConfirm(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
email := r.FormValue("email")
|
||||
|
||||
page := NewHtmlTemplatePage("signup_team_confirm", "Signup Email Sent", c.Locale)
|
||||
page := NewHtmlTemplatePage("signup_team_confirm", c.T("web.signup_team_confirm.title"), c.Locale)
|
||||
page.Props["Email"] = email
|
||||
page.Render(c, w)
|
||||
}
|
||||
@@ -283,7 +283,7 @@ func signupTeamComplete(c *api.Context, w http.ResponseWriter, r *http.Request)
|
||||
hash := r.FormValue("h")
|
||||
|
||||
if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.EmailSettings.InviteSalt)) {
|
||||
c.Err = model.NewAppError("signupTeamComplete", "The signup link does not appear to be valid", "")
|
||||
c.Err = model.NewLocAppError("signupTeamComplete", "web.signup_team_complete.invalid_link.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -291,11 +291,11 @@ func signupTeamComplete(c *api.Context, w http.ResponseWriter, r *http.Request)
|
||||
|
||||
t, err := strconv.ParseInt(props["time"], 10, 64)
|
||||
if err != nil || model.GetMillis()-t > 1000*60*60*24*30 { // 30 days
|
||||
c.Err = model.NewAppError("signupTeamComplete", "The signup link has expired", "")
|
||||
c.Err = model.NewLocAppError("signupTeamComplete", "web.signup_team_complete.link_expired.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("signup_team_complete", "Complete Team Sign Up", c.Locale)
|
||||
page := NewHtmlTemplatePage("signup_team_complete", c.T("web.signup_team_complete.title"), c.Locale)
|
||||
page.Props["Email"] = props["email"]
|
||||
page.Props["Data"] = data
|
||||
page.Props["Hash"] = hash
|
||||
@@ -318,7 +318,7 @@ func signupUserComplete(c *api.Context, w http.ResponseWriter, r *http.Request)
|
||||
} else {
|
||||
team := result.Data.(*model.Team)
|
||||
if !(team.Type == model.TEAM_OPEN || (team.Type == model.TEAM_INVITE && len(team.AllowedDomains) > 0)) {
|
||||
c.Err = model.NewAppError("signupUserComplete", "The team type doesn't allow open invites", "id="+id)
|
||||
c.Err = model.NewLocAppError("signupUserComplete", "web.signup_user_complete.no_invites.app_error", nil, "id="+id)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ func signupUserComplete(c *api.Context, w http.ResponseWriter, r *http.Request)
|
||||
} else {
|
||||
|
||||
if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.EmailSettings.InviteSalt)) {
|
||||
c.Err = model.NewAppError("signupTeamComplete", "The signup link does not appear to be valid", "")
|
||||
c.Err = model.NewLocAppError("signupTeamComplete", "web.signup_user_complete.link_invalid.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -340,12 +340,12 @@ func signupUserComplete(c *api.Context, w http.ResponseWriter, r *http.Request)
|
||||
|
||||
t, err := strconv.ParseInt(props["time"], 10, 64)
|
||||
if err != nil || model.GetMillis()-t > 1000*60*60*48 { // 48 hour
|
||||
c.Err = model.NewAppError("signupTeamComplete", "The signup link has expired", "")
|
||||
c.Err = model.NewLocAppError("signupTeamComplete", "web.signup_user_complete.link_expired.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("signup_user_complete", "Complete User Sign Up", c.Locale)
|
||||
page := NewHtmlTemplatePage("signup_user_complete", c.T("web.signup_user_complete.title"), c.Locale)
|
||||
page.Props["Email"] = props["email"]
|
||||
page.Props["TeamDisplayName"] = props["display_name"]
|
||||
page.Props["TeamName"] = props["name"]
|
||||
@@ -366,7 +366,7 @@ func postPermalink(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
postId := params["postid"]
|
||||
|
||||
if len(postId) != 26 {
|
||||
c.Err = model.NewAppError("postPermalink", "Invalid Post ID", "id="+postId)
|
||||
c.Err = model.NewLocAppError("postPermalink", "web.post_permalink.app_error", nil, "id="+postId)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ func doLoadChannel(c *api.Context, w http.ResponseWriter, r *http.Request, team
|
||||
if ur := <-userChan; ur.Err != nil {
|
||||
c.Err = ur.Err
|
||||
c.RemoveSessionCookie(w, r)
|
||||
l4g.Error("Error in getting users profile for id=%v forcing logout", c.Session.UserId)
|
||||
l4g.Error(utils.T("web.do_load_channel.error"), c.Session.UserId)
|
||||
return
|
||||
} else {
|
||||
user = ur.Data.(*model.User)
|
||||
@@ -586,7 +586,7 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("verify", "Email Verified", c.Locale)
|
||||
page := NewHtmlTemplatePage("verify", c.T("web.email_verified.title"), c.Locale)
|
||||
page.Props["TeamURL"] = c.GetTeamURLFromTeam(team)
|
||||
page.Props["UserEmail"] = email
|
||||
page.Props["ResendSuccess"] = resendSuccess
|
||||
@@ -594,7 +594,7 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func findTeam(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
page := NewHtmlTemplatePage("find_team", "Find Team", c.Locale)
|
||||
page := NewHtmlTemplatePage("find_team", c.T("web.find_team.title"), c.Locale)
|
||||
page.Render(c, w)
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ func docs(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
doc := params["doc"]
|
||||
|
||||
page := NewHtmlTemplatePage("docs", "Documentation", c.Locale)
|
||||
page := NewHtmlTemplatePage("docs", c.T("web.doc.title"), c.Locale)
|
||||
page.Props["Site"] = doc
|
||||
page.Render(c, w)
|
||||
}
|
||||
@@ -618,7 +618,7 @@ func resetPassword(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
isResetLink = false
|
||||
} else {
|
||||
if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.EmailSettings.PasswordResetSalt)) {
|
||||
c.Err = model.NewAppError("resetPassword", "The reset link does not appear to be valid", "")
|
||||
c.Err = model.NewLocAppError("resetPassword", "web.reset_password.invalid_link.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ func resetPassword(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
t, err := strconv.ParseInt(props["time"], 10, 64)
|
||||
if err != nil || model.GetMillis()-t > 1000*60*60 { // one hour
|
||||
c.Err = model.NewAppError("resetPassword", "The signup link has expired", "")
|
||||
c.Err = model.NewLocAppError("resetPassword", "web.reset_password.expired_link.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -661,13 +661,13 @@ func signupWithOAuth(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
teamName := params["team"]
|
||||
|
||||
if !utils.Cfg.TeamSettings.EnableUserCreation {
|
||||
c.Err = model.NewAppError("signupTeam", "User sign-up is disabled.", "")
|
||||
c.Err = model.NewLocAppError("signupTeam", "web.singup_with_oauth.disabled.app_error", nil, "")
|
||||
c.Err.StatusCode = http.StatusNotImplemented
|
||||
return
|
||||
}
|
||||
|
||||
if len(teamName) == 0 {
|
||||
c.Err = model.NewAppError("signupWithOAuth", "Invalid team name", "team_name="+teamName)
|
||||
c.Err = model.NewLocAppError("signupWithOAuth", "web.singup_with_oauth.invalid_team.app_error", nil, "team_name="+teamName)
|
||||
c.Err.StatusCode = http.StatusBadRequest
|
||||
return
|
||||
}
|
||||
@@ -687,18 +687,18 @@ func signupWithOAuth(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
props := model.MapFromJson(strings.NewReader(data))
|
||||
|
||||
if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.EmailSettings.InviteSalt)) {
|
||||
c.Err = model.NewAppError("signupWithOAuth", "The signup link does not appear to be valid", "")
|
||||
c.Err = model.NewLocAppError("signupWithOAuth", "web.singup_with_oauth.invalid_link.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
t, err := strconv.ParseInt(props["time"], 10, 64)
|
||||
if err != nil || model.GetMillis()-t > 1000*60*60*48 { // 48 hours
|
||||
c.Err = model.NewAppError("signupWithOAuth", "The signup link has expired", "")
|
||||
c.Err = model.NewLocAppError("signupWithOAuth", "web.singup_with_oauth.expired_link.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
if team.Id != props["id"] {
|
||||
c.Err = model.NewAppError("signupWithOAuth", "Invalid team name", data)
|
||||
c.Err = model.NewLocAppError("signupWithOAuth", "web.singup_with_oauth.invalid_team.app_error", nil, data)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -770,7 +770,7 @@ func loginWithOAuth(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
loginHint := r.URL.Query().Get("login_hint")
|
||||
|
||||
if len(teamName) == 0 {
|
||||
c.Err = model.NewAppError("loginWithOAuth", "Invalid team name", "team_name="+teamName)
|
||||
c.Err = model.NewLocAppError("loginWithOAuth", "web.login_with_oauth.invalid_team.app_error", nil, "team_name="+teamName)
|
||||
c.Err.StatusCode = http.StatusBadRequest
|
||||
return
|
||||
}
|
||||
@@ -822,7 +822,7 @@ func adminConsole(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
activeTab := params["tab"]
|
||||
teamId := params["team"]
|
||||
|
||||
page := NewHtmlTemplatePage("admin_console", "Admin Console", c.Locale)
|
||||
page := NewHtmlTemplatePage("admin_console", c.T("web.admin_console.title"), c.Locale)
|
||||
page.User = user
|
||||
page.Team = team
|
||||
page.Props["ActiveTab"] = activeTab
|
||||
@@ -832,7 +832,7 @@ func adminConsole(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func authorizeOAuth(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
if !utils.Cfg.ServiceSettings.EnableOAuthServiceProvider {
|
||||
c.Err = model.NewAppError("authorizeOAuth", "The system admin has turned off OAuth service providing.", "")
|
||||
c.Err = model.NewLocAppError("authorizeOAuth", "web.authorize_oauth.disabled.app_error", nil, "")
|
||||
c.Err.StatusCode = http.StatusNotImplemented
|
||||
return
|
||||
}
|
||||
@@ -848,7 +848,7 @@ func authorizeOAuth(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
state := r.URL.Query().Get("state")
|
||||
|
||||
if len(responseType) == 0 || len(clientId) == 0 || len(redirect) == 0 {
|
||||
c.Err = model.NewAppError("authorizeOAuth", "Missing one or more of response_type, client_id, or redirect_uri", "")
|
||||
c.Err = model.NewLocAppError("authorizeOAuth", "web.authorize_oauth.missing.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -868,7 +868,7 @@ func authorizeOAuth(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
team = result.Data.(*model.Team)
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("authorize", "Authorize Application", c.Locale)
|
||||
page := NewHtmlTemplatePage("authorize", c.T("web.authorize_oauth.title"), c.Locale)
|
||||
page.Props["TeamName"] = team.Name
|
||||
page.Props["AppName"] = app.Name
|
||||
page.Props["ResponseType"] = responseType
|
||||
@@ -881,7 +881,7 @@ func authorizeOAuth(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
if !utils.Cfg.ServiceSettings.EnableOAuthServiceProvider {
|
||||
c.Err = model.NewAppError("getAccessToken", "The system admin has turned off OAuth service providing.", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.disabled.app_error", nil, "")
|
||||
c.Err.StatusCode = http.StatusNotImplemented
|
||||
return
|
||||
}
|
||||
@@ -892,25 +892,25 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
grantType := r.FormValue("grant_type")
|
||||
if grantType != model.ACCESS_TOKEN_GRANT_TYPE {
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_request: Bad grant_type", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.bad_grant.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
clientId := r.FormValue("client_id")
|
||||
if len(clientId) != 26 {
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_request: Bad client_id", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.bad_client_id.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
secret := r.FormValue("client_secret")
|
||||
if len(secret) == 0 {
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_request: Missing client_secret", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.bad_client_secret.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
code := r.FormValue("code")
|
||||
if len(code) == 0 {
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_request: Missing code", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.missing_code.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if authData == nil {
|
||||
c.LogAudit("fail - invalid auth code")
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_grant: Invalid or expired authorization code", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.expired_code.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -931,25 +931,25 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if authData.IsExpired() {
|
||||
c.LogAudit("fail - auth code expired")
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_grant: Invalid or expired authorization code", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.expired_code.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
if authData.RedirectUri != redirectUri {
|
||||
c.LogAudit("fail - redirect uri provided did not match previous redirect uri")
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_request: Supplied redirect_uri does not match authorization code redirect_uri", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.redirect_uri.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
if !model.ComparePassword(code, fmt.Sprintf("%v:%v:%v:%v", clientId, redirectUri, authData.CreateAt, authData.UserId)) {
|
||||
c.LogAudit("fail - auth code is invalid")
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_grant: Invalid or expired authorization code", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.expired_code.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
var app *model.OAuthApp
|
||||
if result := <-achan; result.Err != nil {
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_client: Invalid client credentials", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.credentials.app_error", nil, "")
|
||||
return
|
||||
} else {
|
||||
app = result.Data.(*model.OAuthApp)
|
||||
@@ -957,7 +957,7 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if !model.ComparePassword(app.ClientSecret, secret) {
|
||||
c.LogAudit("fail - invalid client credentials")
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_client: Invalid client credentials", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.credentials.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -967,7 +967,7 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if result := <-tchan; result.Err != nil {
|
||||
c.Err = model.NewAppError("getAccessToken", "server_error: Encountered internal server error while accessing database", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.internal.app_error", nil, "")
|
||||
return
|
||||
} else if result.Data != nil {
|
||||
c.LogAudit("fail - auth code has been used previously")
|
||||
@@ -975,16 +975,16 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Revoke access token, related auth code, and session from DB as well as from cache
|
||||
if err := api.RevokeAccessToken(accessData.Token); err != nil {
|
||||
l4g.Error("Encountered an error revoking an access token, err=" + err.Message)
|
||||
l4g.Error(utils.T("web.get_access_token.revoking.error") + err.Message)
|
||||
}
|
||||
|
||||
c.Err = model.NewAppError("getAccessToken", "invalid_grant: Authorization code already exchanged for an access token", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.exchanged.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
var user *model.User
|
||||
if result := <-uchan; result.Err != nil {
|
||||
c.Err = model.NewAppError("getAccessToken", "server_error: Encountered internal server error while pulling user from database", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.internal_user.app_error", nil, "")
|
||||
return
|
||||
} else {
|
||||
user = result.Data.(*model.User)
|
||||
@@ -993,7 +993,7 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
session := &model.Session{UserId: user.Id, TeamId: user.TeamId, Roles: user.Roles, IsOAuth: true}
|
||||
|
||||
if result := <-api.Srv.Store.Session().Save(session); result.Err != nil {
|
||||
c.Err = model.NewAppError("getAccessToken", "server_error: Encountered internal server error while saving session to database", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.internal_session.app_error", nil, "")
|
||||
return
|
||||
} else {
|
||||
session = result.Data.(*model.Session)
|
||||
@@ -1004,7 +1004,7 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if result := <-api.Srv.Store.OAuth().SaveAccessData(accessData); result.Err != nil {
|
||||
l4g.Error(result.Err)
|
||||
c.Err = model.NewAppError("getAccessToken", "server_error: Encountered internal server error while saving access token to database", "")
|
||||
c.Err = model.NewLocAppError("getAccessToken", "web.get_access_token.internal_saving.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1021,7 +1021,7 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
if !utils.Cfg.ServiceSettings.EnableIncomingWebhooks {
|
||||
c.Err = model.NewAppError("incomingWebhook", "Incoming webhooks have been disabled by the system admin.", "")
|
||||
c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.disabled.app_error", nil, "")
|
||||
c.Err.StatusCode = http.StatusNotImplemented
|
||||
return
|
||||
}
|
||||
@@ -1042,13 +1042,13 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if parsedRequest == nil {
|
||||
c.Err = model.NewAppError("incomingWebhook", "Unable to parse incoming data", "")
|
||||
c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.parse.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
text := parsedRequest.Text
|
||||
if len(text) == 0 && parsedRequest.Attachments == nil {
|
||||
c.Err = model.NewAppError("incomingWebhook", "No text specified", "")
|
||||
c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.text.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1066,7 +1066,7 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var hook *model.IncomingWebhook
|
||||
if result := <-hchan; result.Err != nil {
|
||||
c.Err = model.NewAppError("incomingWebhook", "Invalid webhook", "err="+result.Err.Message)
|
||||
c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.invalid.app_error", nil, "err="+result.Err.Message)
|
||||
return
|
||||
} else {
|
||||
hook = result.Data.(*model.IncomingWebhook)
|
||||
@@ -1078,7 +1078,7 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
if len(channelName) != 0 {
|
||||
if channelName[0] == '@' {
|
||||
if result := <-api.Srv.Store.User().GetByUsername(hook.TeamId, channelName[1:]); result.Err != nil {
|
||||
c.Err = model.NewAppError("incomingWebhook", "Couldn't find the user", "err="+result.Err.Message)
|
||||
c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.user.app_error", nil, "err="+result.Err.Message)
|
||||
return
|
||||
} else {
|
||||
channelName = model.GetDMNameFromIds(result.Data.(*model.User).Id, hook.UserId)
|
||||
@@ -1096,7 +1096,7 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
overrideIconUrl := parsedRequest.IconURL
|
||||
|
||||
if result := <-cchan; result.Err != nil {
|
||||
c.Err = model.NewAppError("incomingWebhook", "Couldn't find the channel", "err="+result.Err.Message)
|
||||
c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.channel.app_error", nil, "err="+result.Err.Message)
|
||||
return
|
||||
} else {
|
||||
channel = result.Data.(*model.Channel)
|
||||
@@ -1108,7 +1108,7 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.Session = model.Session{UserId: hook.UserId, TeamId: hook.TeamId, IsOAuth: false}
|
||||
|
||||
if !c.HasPermissionsToChannel(pchan, "createIncomingHook") && channel.Type != model.CHANNEL_OPEN {
|
||||
c.Err = model.NewAppError("incomingWebhook", "Inappropriate channel permissions", "")
|
||||
c.Err = model.NewLocAppError("incomingWebhook", "web.incoming_webhook.permissions.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1133,7 +1133,7 @@ func claimAccount(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var team *model.Team
|
||||
if tResult := <-api.Srv.Store.Team().GetByName(teamName); tResult.Err != nil {
|
||||
l4g.Error("Couldn't find team name=%v, err=%v", teamName, tResult.Err.Message)
|
||||
l4g.Error(utils.T("web.claim_account.team.error"), teamName, tResult.Err.Message)
|
||||
http.Redirect(w, r, api.GetProtocol(r)+"://"+r.Host, http.StatusTemporaryRedirect)
|
||||
return
|
||||
} else {
|
||||
@@ -1143,7 +1143,7 @@ func claimAccount(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
authType := ""
|
||||
if len(email) != 0 {
|
||||
if uResult := <-api.Srv.Store.User().GetByEmail(team.Id, email); uResult.Err != nil {
|
||||
l4g.Error("Couldn't find user teamid=%v, email=%v, err=%v", team.Id, email, uResult.Err.Message)
|
||||
l4g.Error(utils.T("web.claim_account.user.error"), team.Id, email, uResult.Err.Message)
|
||||
http.Redirect(w, r, api.GetProtocol(r)+"://"+r.Host, http.StatusTemporaryRedirect)
|
||||
return
|
||||
} else {
|
||||
@@ -1166,7 +1166,7 @@ func claimAccount(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("claim_account", "Claim Account", c.Locale)
|
||||
page := NewHtmlTemplatePage("claim_account", c.T("web.claim_account.title"), c.Locale)
|
||||
page.Props["Email"] = email
|
||||
page.Props["CurrentType"] = authType
|
||||
page.Props["NewType"] = newType
|
||||
|
||||
Reference in New Issue
Block a user