use of com.sun.identity.password.ui.model.PWResetUserValidationModel in project OpenAM by OpenRock.
the class PWResetUserValidationViewBean method forwardTo.
/**
* Forwards to current view bean after validating organization
*
* @param context request context
*/
public void forwardTo(RequestContext context) {
String classMethod = "PWResetUserValidationViewBean:forwardTo : ";
HttpServletRequest req = context.getRequest();
PWResetUserValidationModel model = (PWResetUserValidationModel) getModel();
ISLocaleContext localeContext = new ISLocaleContext();
localeContext.setLocale(req);
java.util.Locale locale = localeContext.getLocale();
model.setUserLocale(locale.toString());
String orgDN = (String) getPageSessionAttribute(ORG_DN);
if (orgDN == null) {
Hashtable reqDataHash = AuthUtils.parseRequestParameters(req);
String orgParam = AuthUtils.getOrgParam(reqDataHash);
String queryOrg = AuthUtils.getQueryOrgName(req, orgParam);
orgDN = AuthUtils.getOrganizationDN(queryOrg, true, req);
model.setValidRealm(orgDN);
if (debug.messageEnabled()) {
debug.message(classMethod + "orgDN is :" + orgDN);
}
setPageSessionAttribute(ORG_DN, orgDN);
/*
* Set the flag to indicate that user enter the orgname in
* the url.
*/
if (orgParam != null && orgParam.length() > 0) {
setPageSessionAttribute(ORG_DN_FLAG, STRING_TRUE);
model.setRealmFlag(true);
}
} else {
model.setValidRealm(orgDN);
}
super.forwardTo(context);
}
use of com.sun.identity.password.ui.model.PWResetUserValidationModel in project OpenAM by OpenRock.
the class PWResetUserValidationViewBean method beginDisplay.
/**
* Set the required information to display the page.
*
* @param event display event.
* @throws ModelControlException if problem access value of component.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
PWResetUserValidationModel model = (PWResetUserValidationModel) getModel();
if (model.isValidRealm()) {
String orgDN = (String) getPageSessionAttribute(ORG_DN);
String userAttr = model.getUserAttr(orgDN);
HiddenField hf = (HiddenField) getChild(FLD_USER_ATTR);
hf.setValue(userAttr);
setDisplayFieldValue(USER_VALIDATION_TITLE, model.getUserValidateTitleString());
setDisplayFieldValue(LBL_USER_ATTR, model.getLocalizedStrForAttr(userAttr));
setDisplayFieldValue(NEXT_BUTTON, model.getNextBtnLabel());
String userAttrValue = (String) getPageSessionAttribute(USER_ATTR_VALUE);
if (userAttrValue != null && userAttrValue.length() > 0) {
setDisplayFieldValue(TF_USER_ATTR, userAttrValue);
removePageSessionAttribute(USER_ATTR_VALUE);
}
}
}
use of com.sun.identity.password.ui.model.PWResetUserValidationModel in project OpenAM by OpenRock.
the class PWResetUserValidationViewBean method handleBtnNextRequest.
/**
* Handles form submission request
*
* @param event request invocation event
*/
public void handleBtnNextRequest(RequestInvocationEvent event) {
PWResetUserValidationModel model = (PWResetUserValidationModel) getModel();
String userAttrValue = (String) getDisplayFieldValue(TF_USER_ATTR);
if (userAttrValue != null) {
userAttrValue = userAttrValue.trim();
}
HiddenField hf = (HiddenField) getChild(FLD_USER_ATTR);
String userAttrName = (String) hf.getValue();
String orgDN = (String) getPageSessionAttribute(ORG_DN);
String orgDNFlag = (String) getPageSessionAttribute(ORG_DN_FLAG);
RequestContext reqContext = event.getRequestContext();
ISLocaleContext localeContext = new ISLocaleContext();
localeContext.setLocale(reqContext.getRequest());
java.util.Locale localeObj = localeContext.getLocale();
String locale = localeObj.toString();
model.setUserLocale(locale);
if (orgDNFlag != null && orgDNFlag.equals(STRING_TRUE)) {
model.setRealmFlag(true);
}
if (userAttrValue == null || userAttrValue.length() == 0) {
setErrorMessage(model.getErrorTitle(), model.getMissingUserAttrMessage(userAttrName));
forwardTo();
} else {
if (model.isUserAttrValueValid(orgDN, userAttrValue) && model.isUserExists(userAttrValue, userAttrName, orgDN) && model.isUserActive(model.getUserRealm())) {
forwardToPWResetQuestionVB(orgDN, userAttrValue, orgDNFlag, locale);
} else {
setErrorMessage(model.getErrorTitle(), model.getErrorMessage());
forwardTo();
}
}
}
use of com.sun.identity.password.ui.model.PWResetUserValidationModel in project OpenAM by OpenRock.
the class PWResetUserValidationViewBean method forwardToPWResetQuestionVB.
/**
* Forwards to <code>PWResetQuestionViewBean</code>
*
* @param orgDN organization DN
* @param value user attribute value
* @param orgDNFlag true if organization came from URL, false otherwise
*/
private void forwardToPWResetQuestionVB(String orgDN, String value, String orgDNFlag, String locale) {
RequestContext rc = getRequestContext();
PWResetUserValidationModel model = (PWResetUserValidationModel) getModel();
PWResetQuestionViewBean vb = (PWResetQuestionViewBean) getViewBean(PWResetQuestionViewBean.class);
vb.setPageSessionAttribute(USER_DN, model.getUserId());
vb.setPageSessionAttribute(USER_ATTR_VALUE, value);
vb.setPageSessionAttribute(URL_LOCALE, locale);
vb.setPageSessionAttribute(INITIAL_ORG_DN, orgDN);
vb.setPageSessionAttribute(ORG_DN, model.getUserRealm());
if (orgDNFlag != null && orgDNFlag.equals(STRING_TRUE)) {
vb.setPageSessionAttribute(ORG_DN_FLAG, STRING_TRUE);
}
vb.forwardTo(rc);
}
Aggregations