Skip to content

Commit

Permalink
Merge pull request #136 from zlamalp/removeReset
Browse files Browse the repository at this point in the history
Remove password reset request after Metacentrum extension
  • Loading branch information
zlamalp authored Dec 15, 2020
2 parents 057a53a + a2d0697 commit a6ae94f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,30 +158,6 @@ public void onFinished(JavaScriptObject result) {
alert.setText((isAccountActivation) ? translation.activateSuccess() : translation.resetSuccess());
alert.setVisible(true);

/**
* FIXME - Temporary change forcing all extending Metacentrum users to change their password due to need to re-sign all keys in kerberos database
*/
// For authorized reset in EINFRA (meta) namespace set sign to not bother users again in registrar
if (Objects.equals("einfra", namespace) && PerunSession.getInstance().getUserId() > 0) {
AttributesManager.getUserAttribute(PerunSession.getInstance().getUserId(), "urn:perun:user:attribute-def:def:changedPassMeta", new JsonEvents() {
@Override
public void onFinished(JavaScriptObject result) {
Attribute attribute = result.cast();
if (attribute.isEmpty()) {
attribute.setValue(JsUtils.getCurrentDateString());
AttributesManager.setUserAttribute(PerunSession.getInstance().getUserId(), attribute, null);
}
}
@Override
public void onError(PerunException error) {
}

@Override
public void onLoadingStart() {
}
});
}

if (Window.Location.getParameterMap().containsKey("target_url")) {
alert.getToolbar().setVisible(true);
continueButton.setType(ButtonType.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ public interface PerunRegistrarTranslation extends PerunTranslation {
@DefaultMessage("Loading applications")
public String loadingApplications();


/* ------------ MAIL VERIFICATION --------------- */

@DefaultMessage("Email verification")
Expand All @@ -374,20 +373,4 @@ public interface PerunRegistrarTranslation extends PerunTranslation {
@DefaultMessage("We couldn`t verify your email address.")
public String emailWasNotVerified();

/* ------------ TEMPORARY METACENTRUM PASSWORD CHANGE--------------- */

@DefaultMessage("Please reset your password")
public String metaResetHeading();

@DefaultMessage("<p>Dear user,"+
"<p>CESNET e-Infrastructure is changing to a newer encryption algorithm used to authenticate the users. The new algorithm is much more secure and increase compatiblity with newer devices and operating systems (MacOS, etc.)." +
"<p>Because we are not storing your password in a clear text form, it must be re-entered in the password reset application in order to be ciphered by the new encryption algorithm." +
"<p>Within the process, you can choose a new password or enter the old password." +
"<p>You can also change/reset your password at any time later. In such case, the original password remains valid, but will remain encrypted with the older encryption algorithm." +
"<p>If you have any questions, please contact <a href=\"mailto:support@metacentrum.cz\">support@metacentrum.cz</a>.")
public String metaResetText();

@DefaultMessage("Go to password reset")
public String metaResetButton();

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,113 +113,6 @@ public void call(final PerunPrincipal pp, Summary summary, Events<Result> events
}
}

/**
* FIXME - Temporary change forcing all extending Metacentrum users to change their password due to need to re-sign all keys in kerberos database
*/
if (summary.containsVoExtResult()) {

if (summary.getVoExtResult().isOk()) {

AttributesManager.getUserAttributes(pp.getUserId(), Arrays.asList("urn:perun:user:attribute-def:def:login-namespace:einfra",
"urn:perun:user:attribute-def:def:changedPassMeta"), new JsonEvents() {
@Override
public void onFinished(JavaScriptObject result) {

ArrayList<Attribute> list = JsUtils.jsoAsList(result);
boolean hasEinfraLogin = false;
if (list != null) {
for (Attribute a : list) {
if (Objects.equals("login-namespace:einfra", a.getFriendlyName())) {
if (a.getValue() != null) {
hasEinfraLogin = true;
break;
}
}
}

if (hasEinfraLogin) {
for (Attribute a : list) {
if (Objects.equals("changedPassMeta", a.getFriendlyName())) {
if (a.getValue() == null) {
displayMetaCentrumWarning();
}
}
}
}
}
}

@Override
public void onError(PerunException error) {
// display anyway
if (((Vo)summary.getVoExtResult().getBean()).getShortName().equals("meta") ||
((Vo)summary.getVoExtResult().getBean()).getShortName().equals("einfra") ||
((Vo)summary.getVoExtResult().getBean()).getShortName().equals("storage")) {
displayMetaCentrumWarning();
}
}

@Override
public void onLoadingStart() {

}
});

}

}


}

private void displayMetaCentrumWarning() {

final Modal modal = new Modal();
modal.setTitle(translation.metaResetHeading());
modal.setFade(true);
modal.setDataKeyboard(false);
modal.setDataBackdrop(ModalBackdrop.STATIC);
modal.setClosable(false);

ModalBody body = new ModalBody();
body.add(new HTML(translation.metaResetText()));

ModalFooter footer = new ModalFooter();

final Button reset = new Button(translation.metaResetButton(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
modal.hide();
Window.Location.assign(Utils.getPasswordResetLink("einfra"));
}
});
reset.setType(ButtonType.SUCCESS);
reset.setIcon(IconType.CHEVRON_RIGHT);
reset.setIconPosition(IconPosition.RIGHT);
reset.setIconFixedWidth(true);

final Button no = new Button(translation.offerMembershipExtensionNoThanks(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
modal.hide();
}
});
no.setType(ButtonType.DANGER);

footer.add(no);
footer.add(reset);

modal.add(body);
modal.add(footer);

Timer timer = new Timer() {
@Override
public void run() {
modal.show();
}
};
timer.schedule(500);

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,3 @@ loadingApplications=Načítám přihlášky
emailVerification=Ověření emailové adresy
emailWasVerified=Vaše emailová adresa byla ověřena.
emailWasNotVerified=Nepodařilo se ověřit Vaši emailovou adresu.

# // --------------- TEMPORARY METACENTRUM PASSWORD RESET ------------------------------ //
metaResetHeading=Prosím resetujte si heslo
metaResetText=<p>Vážený uživateli,<p>v eInfrastruktuře CESNET dochází k přechodu na nové šifrovací algoritmy, které se používají při autentizaci uživatele. Nové algoritmy jsou bezpečnější a přináší podporu nových zařízení a operačních systémů (MacOS aj.).<p>Protože Vaše heslo nikdy neukládáme v čitelné podobě, je pro jeho zašifrování novým algoritmem potřeba ho znovu zadat v aplikaci pro reset hesla.<p>V rámci procesu si můžete zvolit heslo nové nebo zadat původní.<p>Změnu / reset hesla můžete provést i kdykoliv později. V takovém případě původní heslo zůstává nadále v platnosti, bude však stále zašifrováno starším šifrovacím algoritmem.<p>V případě dotazu se prosím obraťte na <a href="mailto:support@metacentrum.cz">support@metacentrum.cz</a>.
metaResetButton=Přejít na reset hesla

0 comments on commit a6ae94f

Please sign in to comment.