Skip to content

Commit

Permalink
reset password panel refactoring + finished styles
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Feb 16, 2023
1 parent 590edb5 commit 86c4bd7
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<form wicket:id="mainForm" class="form-horizontal">
<div wicket:id="changePasswordPanel"/>
</form>
<a class="text-center login-panel-control mt-2" style="display: inline-block;" wicket:id="back">
<i class="fas fa-arrow-left mr-2"></i>
<wicket:message key="PageEmailNonce.backButtonLabel"/>
</a>
</wicket:extend>

</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;

import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.form.MidpointForm;

import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -52,6 +53,8 @@ public class PageResetPassword extends AbstractPageLogin {

protected static final String ID_MAIN_FORM = "mainForm";
private static final String ID_CHANGE_PASSWORD_PANEL = "changePasswordPanel";
private static final String CHANGE_PASSWORD_BUTTON_STYLE = "btn btn-primary login-panel-control";
private static final String ID_BACK_BUTTON = "back";

public PageResetPassword() {
// TODO Auto-generated constructor stub
Expand Down Expand Up @@ -118,9 +121,24 @@ protected boolean isPasswordLimitationPopupVisible() {
return true;
}

@Override
protected String getChangePasswordButtonStyle() {
return CHANGE_PASSWORD_BUTTON_STYLE;
}
};
changePasswordPanel.setOutputMarkupId(true);
form.add(changePasswordPanel);
AjaxButton backButton = new AjaxButton(ID_BACK_BUTTON) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
cancelPerformed();
}
};
backButton.setOutputMarkupId(true);
add(backButton);

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,8 @@ protected void confirmAuthentication() {
}
}

protected void cancelPerformed() {
setResponsePage(getMidpointApplication().getHomePage());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h4>
<label class="col-md-4 mr-3" wicket:id="attributeName"></label>
<input type="text" class="form-control form-control-sm" wicket:id="attributeValue"/>
</div>
<div class="pull-right">
<div>
<a class="btn btn-default" wicket:id="back"><wicket:message key="PageBase.button.back"/>
</a>
<input type="submit" class="btn btn-primary" wicket:message="value:PageBase.button.send" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.jetbrains.annotations.NotNull;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import com.evolveum.midpoint.authentication.api.AuthenticationChannel;
import com.evolveum.midpoint.authentication.api.config.MidpointAuthentication;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.PrismProperty;
Expand All @@ -43,7 +41,6 @@
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.prism.DynamicFormPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType;
Expand Down Expand Up @@ -152,10 +149,6 @@ protected boolean isDynamicForm() {
return getFormRef() != null;
}

protected void cancelPerformed() {
setResponsePage(getMidpointApplication().getHomePage());
}

protected AjaxButton createBackButton(String id){
return new AjaxButton(id) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@
<div wicket:id="dynamicLayout" class="mb-2">
<div wicket:id="dynamicForm"/>
</div>

<div class="d-flex flex-wrap gap-2 justify-content-between login-panel-control mb-2">
<a class="btn btn-primary flex-wrap gap-2 justify-content-center login-panel-control" wicket:id="submitIdentifier">
</a>
<a class="text-center login-panel-control" wicket:id="back">
<i class="fas fa-arrow-left mr-2"></i>
<span wicket:id="backButtonLabel" />
</a>
</div>
<a class="btn btn-primary flex-wrap gap-2 justify-content-center login-panel-control" wicket:id="submitIdentifier">
</a>
</form>

<a class="text-center login-panel-control mt-2" style="display: inline-block;" wicket:id="back">
<i class="fas fa-arrow-left mr-2"></i>
<span wicket:id="backButtonLabel"/>
</a>
</wicket:extend>

</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;

import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
Expand All @@ -22,13 +21,11 @@
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
import org.apache.wicket.request.cycle.RequestCycle;
import org.jetbrains.annotations.NotNull;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.WebAttributes;
Expand Down Expand Up @@ -57,8 +54,6 @@
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
import com.evolveum.midpoint.web.component.form.MidpointForm;
import com.evolveum.midpoint.web.component.prism.DynamicFormPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.security.MidPointApplication;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;

Expand Down Expand Up @@ -98,16 +93,7 @@ public PageEmailNonce() {

protected void initCustomLayout() {
MidpointForm form = new MidpointForm(ID_MAIN_FORM);
form.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return !submited;
}

});
form.add(new VisibleBehaviour(() -> !submited));
add(form);

initStaticLayout(form);
Expand All @@ -133,9 +119,10 @@ protected void onError(AjaxRequestTarget target) {
}

};
submitUserIdentifier.add(new VisibleBehaviour(() -> !submited));
form.add(submitUserIdentifier);

form.add(createBackButton(ID_BACK_BUTTON));
add(createBackButton(ID_BACK_BUTTON));
}

@Override
Expand All @@ -150,14 +137,7 @@ public void onClick(AjaxRequestTarget target) {
};
backButton.setOutputMarkupId(true);

Label backButtonLabel = new Label(ID_BACK_BUTTON_LABEL, new LoadableModel<String>() {
private static final long serialVersionUID = 1L;

@Override
protected String load() {
return createStringResource("PageEmailNonce.backButtonLabel").getString();
}
});
Label backButtonLabel = new Label(ID_BACK_BUTTON_LABEL, createStringResource("PageEmailNonce.backButtonLabel"));
backButton.add(backButtonLabel);
return backButton;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="d-flex flex-wrap gap-2 mb-2">
<div class="col-md-5">
<div class="row">
<div class="col">
<wicket:enclosure child="currentPassword">
<label class="col-form-label">
<wicket:message key="ChangePasswordPanel.currentPassword"/>
</label>
<div class="">
<div class="password-parent" style="height:30px; position: relative;">
<div class="col-md-12" style="padding: 0px !important;">
<input class="form-control form-control-sm" type="password" autocomplete="new-password" wicket:id="currentPassword" autofocus style="padding-right: 26px;"/>
</div>
<div style="position: absolute; right: 8px; top: 8px; z-index: 5;">
<i class="fa fa-eye" style="float:right;cursor: pointer; color: #555555;" onclick="MidPointTheme.showPassword(this)"></i>
</div>
<div class="password-parent" style="height:30px; position: relative;">
<div class="col-md-12" style="padding: 0px !important;">
<input class="form-control form-control-sm" type="password" autocomplete="new-password" wicket:id="currentPassword" autofocus style="padding-right: 26px;"/>
</div>
<div style="position: absolute; right: 8px; top: 8px; z-index: 5;">
<i class="fa fa-eye" style="float:right;cursor: pointer; color: #555555;" onclick="MidPointTheme.showPassword(this)"></i>
</div>
</div>
</wicket:enclosure>
Expand All @@ -36,7 +34,7 @@
</div>
</div>
<wicket:enclosure child="passwordValidationPanel">
<div class="col-md-5">
<div class="col">
<label class="col-form-label card-header" style="border: none !important;">
<wicket:message key="ChangePasswordPanel.passwordRequirementsLabel"/>
</label>
Expand All @@ -46,8 +44,8 @@
</div>
<wicket:child/>

<div class="main-button-bar">
<a class="btn btn-success" wicket:id="changePassword"/>
<div class="main-button-bar mt-3">
<a wicket:id="changePassword"/>
</div>
</wicket:panel>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.PasswordTextField;
Expand All @@ -60,6 +61,7 @@ public class ChangePasswordPanel<F extends FocusType> extends BasePanel<F> {
private static final String ID_PASSWORD_HINT_PANEL = "passwordHintPanel";
private static final String ID_CHANGE_PASSWORD = "changePassword";
private static final String ID_PASSWORD_VALIDATION_PANEL = "passwordValidationPanel";
private static final String CHANGE_PASSWORD_BUTTON_STYLE = "btn btn-success";

private static final String DOT_CLASS = ChangePasswordPanel.class.getName() + ".";
private static final String OPERATION_VALIDATE_PASSWORD = DOT_CLASS + "validatePassword";
Expand Down Expand Up @@ -203,12 +205,17 @@ public void onSubmit(AjaxRequestTarget target) {
}
};
changePasswordButton.add(new VisibleBehaviour(() -> !savedPassword));
changePasswordButton.add(AttributeAppender.append("class", getChangePasswordButtonStyle()));
changePasswordButton.setOutputMarkupId(true);
add(changePasswordButton);

}

protected void updateNewPasswordValuePerformed(AjaxRequestTarget target) {
protected String getChangePasswordButtonStyle() {
return CHANGE_PASSWORD_BUTTON_STYLE;
}

private void updateNewPasswordValuePerformed(AjaxRequestTarget target) {
target.add(get(ID_PASSWORD_VALIDATION_PANEL));
}

Expand Down

0 comments on commit 86c4bd7

Please sign in to comment.