Skip to content

Commit

Permalink
feat(profile): support password change/reset for einfra namespace
Browse files Browse the repository at this point in the history
- Support password change and reset operations on a profile page
  for login-namespace: einfra.
- Password reset redirects to pwd reset application.
- Password change displays custom dialog with appropriate password
  checks and requires old password.
  • Loading branch information
zlamalp committed Jun 15, 2022
1 parent dead409 commit 6bce4af
Show file tree
Hide file tree
Showing 6 changed files with 490 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,38 @@ public interface PerunTranslation extends Messages {
@DefaultMessage("Password <b>can`t contain login, name or surname</b>, not even backwards!")
public String einfraPasswordStrengthForNameLogin();

@DefaultMessage("New password can`t be empty!")
public String passwordCantBeEmpty();

@DefaultMessage("Passwords dont`t match!")
public String passwordMismatch();

@DefaultMessage("Confirm your new password!")
public String secondPasswordIsEmpty();

@DefaultMessage("Old password:")
public String oldPassLabel();
@DefaultMessage("Enter your old password")
public String enterOldPassPlaceholder();

@DefaultMessage("New password:")
public String newPassLabel();

@DefaultMessage("Enter your new password")
public String enterNewPassPlaceholder();

@DefaultMessage("Confirm your new password")
public String repeatNewPassPlaceholder();

@DefaultMessage("Change password")
public String changePasswordButton();

@DefaultMessage("<b>Your password for login <i>{0}</i> has been changed!</b><br/>It might take a few minutes to reflect this change across our infrastructure.")
public String passwordHasBeenChanged(String login);

@DefaultMessage("Incorrect password!")
public String oldPasswordIncorrect();

@DefaultMessage("Password must <ul><li>be at least 12 characters long<li>consist of at least 3 of 4 character groups<ul><li>lower-case letters<li>upper-case letters<li>digits<li>special characters</ul></ul>")
public String muPasswordHelp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ public static Request isLoginAvailable(String namespace, String login, JsonEvent

}

/**
* Checks Password Strength against namespace constraints.
* Throws exception when constraint check fails.
*
* @param namespace namespace to check password in
* @param password password to be checked
* @param events Events done on callback
* @return Request unique request
*/
public static Request checkPasswordStrength(String namespace, String password, JsonEvents events) {

JsonClient client = new JsonClient(events);
client.put("password", password);
client.put("namespace", namespace);
return client.call(USERS_MANAGER + "checkPasswordStrength");

}


/**
* Search for RichUsers with attributes who matches the searchString by name, login or email.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ einfraPasswordLength=Heslo musí mít <b>alespoň 10 znaků!</b>
einfraPasswordFormat=Heslo <b>nesmí obsahovat diakritiku</b> nebo řídící a formátovací znaky!</b>
einfraPasswordStrength=Heslo musí obsahovat <b>alespoň 3 ze 4</b> kategorií znaků<ul><li>malá písmena</li><li>velká písmena</li><li>číslice</li><li>speciální znaky</li></ul>
einfraPasswordStrengthForNameLogin=Heslo <b>nesmí obsahovat login, jméno nebo příjmení</b> a to ani pozpátku!
passwordCantBeEmpty=Nové heslo nesmí být prázdné!
passwordMismatch=Hesla se neshodují!
secondPasswordIsEmpty=Zopakujte nové heslo pro kontrolu
oldPassLabel=Staré heslo:
enterOldPassPlaceholder=Zadejte své staré heslo
newPassLabel=Nové heslo:
enterNewPassPlaceholder=Zadejte nové heslo
repeatNewPassPlaceholder=Zopakujte nové heslo pro kontrolu
changePasswordButton=Změnit heslo
passwordHasBeenChanged=<b>Vaše heslo pro login <i>{0}</i> bylo změněno!</b><br/>Změna se na infrstruktuře může projevit s mírným zpožděním.
oldPasswordIncorrect=Špatné heslo!
muPasswordHelp=Heslo musí<ul><li>mít délku 12 a více znaků<li>obsahovat alespoň 3 ze 4 kategorií znaků<ul><li>malá písmena<li>velká písmena<li>číslice<li>speciální znaky</ul></ul>
muPasswordLength=Heslo musí mít <b>alespoň 12 znaků!</b>
muPasswordStrength=Heslo musí obsahovat <b>alespoň 3 ze 4</b> kategorií znaků<ul><li>malá písmena</li><li>velká písmena</li><li>číslice</li><li>speciální znaky</li></ul>
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ public interface PerunProfileTranslation extends PerunTranslation {
@DefaultMessage("Change")
String updateEmail();

@DefaultMessage("Change password")
String changePassword();

@DefaultMessage("Reset password")
String resetPassword();

@DefaultMessage("Change password for {0}")
String changePasswordModalTitle(String login);

@DefaultMessage("Old password can`t be empty!")
String oldPassCantBeEmpty();

@DefaultMessage("New e-mail")
String newPreferredEmail();

Expand Down
Loading

0 comments on commit 6bce4af

Please sign in to comment.