diff --git a/public/app/features/profile/ChangePasswordForm.tsx b/public/app/features/profile/ChangePasswordForm.tsx index a41505ffa3b..7f63b646ddb 100644 --- a/public/app/features/profile/ChangePasswordForm.tsx +++ b/public/app/features/profile/ChangePasswordForm.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { Button, Field, Form, HorizontalGroup, LinkButton } from '@grafana/ui'; import config from 'app/core/config'; +import { t, Trans } from 'app/core/internationalization'; import { UserDTO } from 'app/types'; import { PasswordField } from '../../core/components/PasswordField/PasswordField'; @@ -20,10 +21,20 @@ export const ChangePasswordForm = ({ user, onChangePassword, isSaving }: Props) const authSource = user.authLabels?.length && user.authLabels[0]; if (authSource === 'LDAP' || authSource === 'Auth Proxy') { - return

You cannot change password when signed in with LDAP or auth proxy.

; + return ( +

+ + You cannot change password when signed in with LDAP or auth proxy. + +

+ ); } if (authSource && disableLoginForm) { - return

Password cannot be changed here.

; + return ( +

+ Password cannot be changed here. +

+ ); } return ( @@ -36,44 +47,70 @@ export const ChangePasswordForm = ({ user, onChangePassword, isSaving }: Props) {({ register, errors, getValues }) => { return ( <> - + - + v === getValues().confirmNew || 'Passwords must match', - old: (v) => v !== getValues().oldPassword || `New password can't be the same as the old one.`, + confirm: (v) => + v === getValues().confirmNew || + t('profile.change-password.passwords-must-match', 'Passwords must match'), + old: (v) => + v !== getValues().oldPassword || + t( + 'profile.change-password.new-password-same-as-old', + "New password can't be the same as the old one." + ), }, })} /> - + v === getValues().newPassword || 'Passwords must match', + required: t( + 'profile.change-password.confirm-password-required', + 'New password confirmation is required' + ), + validate: (v) => + v === getValues().newPassword || + t('profile.change-password.passwords-must-match', 'Passwords must match'), })} /> - Cancel + Cancel diff --git a/public/locales/de-DE/grafana.json b/public/locales/de-DE/grafana.json index 4a69fc6ae23..7b129ff43b8 100644 --- a/public/locales/de-DE/grafana.json +++ b/public/locales/de-DE/grafana.json @@ -681,6 +681,22 @@ "title": "" } }, + "profile": { + "change-password": { + "cancel-button": "", + "cannot-change-password-message": "", + "change-password-button": "", + "confirm-password-label": "", + "confirm-password-required": "", + "ldap-auth-proxy-message": "", + "new-password-label": "", + "new-password-required": "", + "new-password-same-as-old": "", + "old-password-label": "", + "old-password-required": "", + "passwords-must-match": "" + } + }, "refresh-picker": { "aria-label": { "choose-interval": "Automatische Aktualisierung ausgeschaltet. Aktualisierungszeitintervall auswählen", diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 4e3cbc02e6e..5bfb73ca21f 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -681,6 +681,22 @@ "title": "There are no playlists created yet" } }, + "profile": { + "change-password": { + "cancel-button": "Cancel", + "cannot-change-password-message": "Password cannot be changed here.", + "change-password-button": "Change Password", + "confirm-password-label": "Confirm password", + "confirm-password-required": "New password confirmation is required", + "ldap-auth-proxy-message": "You cannot change password when signed in with LDAP or auth proxy.", + "new-password-label": "New password", + "new-password-required": "New password is required", + "new-password-same-as-old": "New password can't be the same as the old one.", + "old-password-label": "Old password", + "old-password-required": "Old password is required", + "passwords-must-match": "Passwords must match" + } + }, "refresh-picker": { "aria-label": { "choose-interval": "Auto refresh turned off. Choose refresh time interval", diff --git a/public/locales/es-ES/grafana.json b/public/locales/es-ES/grafana.json index 6a54352db6c..b40c19bc8ae 100644 --- a/public/locales/es-ES/grafana.json +++ b/public/locales/es-ES/grafana.json @@ -686,6 +686,22 @@ "title": "" } }, + "profile": { + "change-password": { + "cancel-button": "", + "cannot-change-password-message": "", + "change-password-button": "", + "confirm-password-label": "", + "confirm-password-required": "", + "ldap-auth-proxy-message": "", + "new-password-label": "", + "new-password-required": "", + "new-password-same-as-old": "", + "old-password-label": "", + "old-password-required": "", + "passwords-must-match": "" + } + }, "refresh-picker": { "aria-label": { "choose-interval": "Actualización automática desactivada. Elija un intervalo de tiempo de actualización", diff --git a/public/locales/fr-FR/grafana.json b/public/locales/fr-FR/grafana.json index 800197b1483..5da4289a1df 100644 --- a/public/locales/fr-FR/grafana.json +++ b/public/locales/fr-FR/grafana.json @@ -686,6 +686,22 @@ "title": "" } }, + "profile": { + "change-password": { + "cancel-button": "", + "cannot-change-password-message": "", + "change-password-button": "", + "confirm-password-label": "", + "confirm-password-required": "", + "ldap-auth-proxy-message": "", + "new-password-label": "", + "new-password-required": "", + "new-password-same-as-old": "", + "old-password-label": "", + "old-password-required": "", + "passwords-must-match": "" + } + }, "refresh-picker": { "aria-label": { "choose-interval": "Actualisation automatique désactivée. Choisir un intervalle de temps d'actualisation", diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index ff6033e16ea..5d7d813ef9f 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -681,6 +681,22 @@ "title": "Ŧĥęřę äřę ʼnő pľäyľįşŧş čřęäŧęđ yęŧ" } }, + "profile": { + "change-password": { + "cancel-button": "Cäʼnčęľ", + "cannot-change-password-message": "Päşşŵőřđ čäʼnʼnőŧ þę čĥäʼnģęđ ĥęřę.", + "change-password-button": "Cĥäʼnģę Päşşŵőřđ", + "confirm-password-label": "Cőʼnƒįřm päşşŵőřđ", + "confirm-password-required": "Ńęŵ päşşŵőřđ čőʼnƒįřmäŧįőʼn įş řęqūįřęđ", + "ldap-auth-proxy-message": "Ÿőū čäʼnʼnőŧ čĥäʼnģę päşşŵőřđ ŵĥęʼn şįģʼnęđ įʼn ŵįŧĥ ĿĐÅP őř äūŧĥ přőχy.", + "new-password-label": "Ńęŵ päşşŵőřđ", + "new-password-required": "Ńęŵ päşşŵőřđ įş řęqūįřęđ", + "new-password-same-as-old": "Ńęŵ päşşŵőřđ čäʼn'ŧ þę ŧĥę şämę äş ŧĥę őľđ őʼnę.", + "old-password-label": "Øľđ päşşŵőřđ", + "old-password-required": "Øľđ päşşŵőřđ įş řęqūįřęđ", + "passwords-must-match": "Päşşŵőřđş mūşŧ mäŧčĥ" + } + }, "refresh-picker": { "aria-label": { "choose-interval": "Åūŧő řęƒřęşĥ ŧūřʼnęđ őƒƒ. Cĥőőşę řęƒřęşĥ ŧįmę įʼnŧęřväľ", diff --git a/public/locales/zh-Hans/grafana.json b/public/locales/zh-Hans/grafana.json index 539ddebd8f6..0396e9de860 100644 --- a/public/locales/zh-Hans/grafana.json +++ b/public/locales/zh-Hans/grafana.json @@ -676,6 +676,22 @@ "title": "" } }, + "profile": { + "change-password": { + "cancel-button": "", + "cannot-change-password-message": "", + "change-password-button": "", + "confirm-password-label": "", + "confirm-password-required": "", + "ldap-auth-proxy-message": "", + "new-password-label": "", + "new-password-required": "", + "new-password-same-as-old": "", + "old-password-label": "", + "old-password-required": "", + "passwords-must-match": "" + } + }, "refresh-picker": { "aria-label": { "choose-interval": "自动刷新已关闭。选择刷新时间间隔",