Search in sources :

Example 1 with PWResetUserValidationModel

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);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) PWResetUserValidationModel(com.sun.identity.password.ui.model.PWResetUserValidationModel) Hashtable(java.util.Hashtable) ISLocaleContext(com.sun.identity.common.ISLocaleContext)

Example 2 with PWResetUserValidationModel

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);
        }
    }
}
Also used : PWResetUserValidationModel(com.sun.identity.password.ui.model.PWResetUserValidationModel) HiddenField(com.iplanet.jato.view.html.HiddenField)

Example 3 with PWResetUserValidationModel

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();
        }
    }
}
Also used : PWResetUserValidationModel(com.sun.identity.password.ui.model.PWResetUserValidationModel) HiddenField(com.iplanet.jato.view.html.HiddenField) RequestContext(com.iplanet.jato.RequestContext) ISLocaleContext(com.sun.identity.common.ISLocaleContext)

Example 4 with PWResetUserValidationModel

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);
}
Also used : PWResetUserValidationModel(com.sun.identity.password.ui.model.PWResetUserValidationModel) RequestContext(com.iplanet.jato.RequestContext)

Aggregations

PWResetUserValidationModel (com.sun.identity.password.ui.model.PWResetUserValidationModel)4 RequestContext (com.iplanet.jato.RequestContext)2 HiddenField (com.iplanet.jato.view.html.HiddenField)2 ISLocaleContext (com.sun.identity.common.ISLocaleContext)2 Hashtable (java.util.Hashtable)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1