diff --git a/client/components/password-change/password-change.js b/client/components/password-change/password-change.js index 49839e85..4255ea56 100644 --- a/client/components/password-change/password-change.js +++ b/client/components/password-change/password-change.js @@ -39,18 +39,12 @@ export default class PasswordChange extends React.Component { async componentDidMount() { const {setLoading} = this.context; - const { - setTitle, - orgName, - cookies, - userData, - setUserData, - logout, - orgSlug, - language, - } = this.props; + const {setTitle, orgName, cookies, setUserData, logout, orgSlug, language} = + this.props; + let {userData} = this.props; setLoading(true); setTitle(t`PWD_CHANGE_TITL`, orgName); + const {mustLogin, mustLogout, repeatLogin} = userData; await validateToken( cookies, orgSlug, @@ -59,6 +53,8 @@ export default class PasswordChange extends React.Component { logout, language, ); + ({userData} = this.props); + setUserData({...userData, mustLogin, mustLogout, repeatLogin}); setLoading(false); } @@ -224,11 +220,13 @@ export default class PasswordChange extends React.Component { /> -
- - {t`CANCEL`} - -
+ {userData.password_expired !== true && ( +
+ + {t`CANCEL`} + +
+ )} diff --git a/client/components/status/status.js b/client/components/status/status.js index f8735f13..fb79b511 100644 --- a/client/components/status/status.js +++ b/client/components/status/status.js @@ -67,6 +67,7 @@ export default class Status extends React.Component { setTitle, orgName, language, + navigate, } = this.props; setTitle(t`STATUS_TITL`, orgName); const {setLoading} = this.context; @@ -114,7 +115,16 @@ export default class Status extends React.Component { const {mustLogin, mustLogout, repeatLogin} = userData; ({userData} = this.props); - + if (userData.password_expired === true) { + toast.warning(t`PASSWORD_EXPIRED`); + setUserData({ + ...userData, + mustLogin, + mustLogout, + repeatLogin, + }); + navigate(`/${orgSlug}/change-password`); + } const { radius_user_token: password, username, diff --git a/client/utils/validate-token.js b/client/utils/validate-token.js index 5ff8d390..7c2a9296 100644 --- a/client/utils/validate-token.js +++ b/client/utils/validate-token.js @@ -24,7 +24,9 @@ const validateToken = async ( // or payment_url of user is undefined if ( userData && - ((token && userData.radius_user_token === undefined) || + ((token && + (userData.radius_user_token === undefined || + userData.password_expired === true)) || (userData.method === "bank_card" && userData.is_verified !== true && !userData.payment_url)) diff --git a/i18n/de.po b/i18n/de.po index 81a35c44..62e4d6ac 100644 --- a/i18n/de.po +++ b/i18n/de.po @@ -37,6 +37,10 @@ msgstr "Es ist ein Fehler aufgetreten!" msgid "LOGOUT_SUCCESS" msgstr "Logout war erfolgreich" +#: client/components/status/status.js:119 +msgid "PASSWORD_EXPIRED" +msgstr "Ihr Passwort ist abgelaufen, bitte ändern Sie Ihr Passwort." + #: client/components/status/status.js:467 #: client/components/status/status.js:658 msgid "ACCT_ACTIVE" diff --git a/i18n/en.po b/i18n/en.po index 0c119b9e..7f58e876 100644 --- a/i18n/en.po +++ b/i18n/en.po @@ -517,6 +517,10 @@ msgstr "Login successful" msgid "LOGOUT_SUCCESS" msgstr "Logout successful" +#: client/components/status/status.js:119 +msgid "PASSWORD_EXPIRED" +msgstr "Your password has expired, please change your password." + #: client/components/password-change/password-change.js:101 #: client/components/password-change/password-change.js:109 #: client/components/password-change/password-change.test.js:129 diff --git a/i18n/fur.po b/i18n/fur.po index 10e47b3c..6f26a12d 100644 --- a/i18n/fur.po +++ b/i18n/fur.po @@ -510,6 +510,10 @@ msgstr "Al è capitât un erôr!" msgid "LOGOUT_SUCCESS" msgstr "Logout fat cun sucès" +#: client/components/status/status.js:119 +msgid "PASSWORD_EXPIRED" +msgstr "La tua password è scaduta, modifica la password." + #: client/components/password-change/password-change.js:61 #: client/components/password-change/password-change.test.js:115 #: client/components/password-change/password-change.test.js:120 diff --git a/i18n/it.po b/i18n/it.po index e6ba31e7..44f14573 100644 --- a/i18n/it.po +++ b/i18n/it.po @@ -512,6 +512,10 @@ msgstr "Si è verificato un errore!" msgid "LOGOUT_SUCCESS" msgstr "Log out effettuato con successo" +#: client/components/status/status.js:119 +msgid "PASSWORD_EXPIRED" +msgstr "La tua password è scaduta, modifica la password." + #: client/components/password-change/password-change.js:61 #: client/components/password-change/password-change.test.js:115 #: client/components/password-change/password-change.test.js:120 diff --git a/i18n/ru.po b/i18n/ru.po index 92bb7f87..173f35ce 100644 --- a/i18n/ru.po +++ b/i18n/ru.po @@ -508,6 +508,10 @@ msgstr "Была ошибка!" msgid "LOGOUT_SUCCESS" msgstr "Успешный выход" +#: client/components/status/status.js:119 +msgid "PASSWORD_EXPIRED" +msgstr "Срок действия вашего пароля истек, пожалуйста, измените пароль." + #: client/components/password-change/password-change.js:61 #: client/components/password-change/password-change.test.js:115 #: client/components/password-change/password-change.test.js:120 diff --git a/i18n/sl.po b/i18n/sl.po index baf8fe0f..2839d0ad 100644 --- a/i18n/sl.po +++ b/i18n/sl.po @@ -454,6 +454,10 @@ msgstr "Prijava je bila uspešna" msgid "LOGOUT_SUCCESS" msgstr "Odjava je bila uspešna" +#: client/components/status/status.js:119 +msgid "PASSWORD_EXPIRED" +msgstr "Vaše geslo je poteklo, spremenite geslo." + #: client/components/password-change/password-change.js:87 #: client/components/password-change/password-change.js:93 #: client/components/password-change/password-change.test.js:129