Search in sources :

Example 1 with HiddenField

use of com.iplanet.jato.view.html.HiddenField 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 2 with HiddenField

use of com.iplanet.jato.view.html.HiddenField 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 3 with HiddenField

use of com.iplanet.jato.view.html.HiddenField in project OpenAM by OpenRock.

the class PWResetQuestionTiledView method nextTile.

/**
     * Moves the current tile position to the next available tile.
     *
     * @return true if another tile was available, false if the position
     *         remained unchanged because no next tile was available.
     *
     * @throws ModelControlException if manipulation of model fails.
     */
public boolean nextTile() throws ModelControlException {
    boolean movedToRow = super.nextTile();
    PWResetQuestionModel model = getModel();
    if (movedToRow) {
        String question = (String) list.get(getTileIndex());
        String localizedStr = model.getLocalizedStrForQuestion(question);
        HiddenField hf = (HiddenField) getChild(FLD_ATTR_NAME);
        hf.setValue(question);
        setDisplayFieldValue(LBL_QUESTION, localizedStr);
    }
    return movedToRow;
}
Also used : HiddenField(com.iplanet.jato.view.html.HiddenField) PWResetQuestionModel(com.sun.identity.password.ui.model.PWResetQuestionModel)

Example 4 with HiddenField

use of com.iplanet.jato.view.html.HiddenField in project OpenAM by OpenRock.

the class PWResetQuestionTiledView method getAnswers.

/**
     * Gets the answer to the secret question
     *
     * @return answer to the secret question
     */
public Map getAnswers() {
    Map map = Collections.EMPTY_MAP;
    PWResetQuestionModel model = getModel();
    try {
        DatasetModel dataModel = getPrimaryModel();
        int size = dataModel.getSize();
        if (size > 0) {
            dataModel.first();
            map = new HashMap(size);
        }
        for (int i = 0; i < size; i++) {
            HiddenField hf = (HiddenField) getChild(FLD_ATTR_NAME);
            String attrName = (String) hf.getValue();
            String answer = (String) getDisplayFieldValue(TF_ANSWER);
            if (answer != null) {
                answer = answer.trim();
            }
            if (answer == null || answer.length() == 0) {
                missingData = true;
            }
            map.put(attrName, answer);
            dataModel.next();
        }
    } catch (ModelControlException mce) {
        model.debugError("PWResetQuestionTiledView.getAnswers", mce);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) HiddenField(com.iplanet.jato.view.html.HiddenField) ModelControlException(com.iplanet.jato.model.ModelControlException) HashMap(java.util.HashMap) Map(java.util.Map) DatasetModel(com.iplanet.jato.model.DatasetModel) PWResetQuestionModel(com.sun.identity.password.ui.model.PWResetQuestionModel)

Aggregations

HiddenField (com.iplanet.jato.view.html.HiddenField)4 PWResetQuestionModel (com.sun.identity.password.ui.model.PWResetQuestionModel)2 PWResetUserValidationModel (com.sun.identity.password.ui.model.PWResetUserValidationModel)2 RequestContext (com.iplanet.jato.RequestContext)1 DatasetModel (com.iplanet.jato.model.DatasetModel)1 ModelControlException (com.iplanet.jato.model.ModelControlException)1 ISLocaleContext (com.sun.identity.common.ISLocaleContext)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1