Search in sources :

Example 1 with CCPassword

use of com.sun.web.ui.view.html.CCPassword in project OpenAM by OpenRock.

the class ServerEditViewBeanBase method getAttributeValues.

protected Map<String, String> getAttributeValues() {
    Map<String, String> map = new HashMap<String, String>();
    for (String uiName : activePropertyNames) {
        View view = getChild(uiName);
        String value;
        if (view instanceof CCEditableList) {
            CCEditableList list = (CCEditableList) view;
            list.restoreStateData();
            // Create a comma delimited String from the items in the OptionList for storage.
            value = StringUtils.join(getValues(list.getModel().getOptionList()), ",");
        } else {
            value = (String) getDisplayFieldValue(uiName);
        }
        String propertyName = getActualPropertyName(uiName);
        if (view instanceof CCCheckBox) {
            value = (value.equals("true")) ? ServerPropertyValidator.getTrueValue(propertyName) : ServerPropertyValidator.getFalseValue(propertyName);
        }
        if (view instanceof CCPassword) {
            // encrypt and include in the map of attribute values to save
            if (!AMPropertySheetModel.passwordRandom.equals(value)) {
                value = AccessController.doPrivileged(new EncodeAction(value));
                map.put(propertyName, value);
            }
        } else {
            map.put(propertyName, value);
        }
    }
    return map;
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) EncodeAction(com.sun.identity.security.EncodeAction) HashMap(java.util.HashMap) CCCheckBox(com.sun.web.ui.view.html.CCCheckBox) View(com.iplanet.jato.view.View) CCPassword(com.sun.web.ui.view.html.CCPassword)

Example 2 with CCPassword

use of com.sun.web.ui.view.html.CCPassword in project OpenAM by OpenRock.

the class UMChangeUserPasswordViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    UMChangeUserPasswordModel model = (UMChangeUserPasswordModel) getModel();
    String userId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    if (userId == null) {
        userId = model.getUserName();
    }
    String loggedinUser = model.getUserName();
    //is same as logged in user
    if (model.isOldPasswordRequired() && LDAPUtils.rdnValueFromDn(userId).equalsIgnoreCase(LDAPUtils.rdnValueFromDn(loggedinUser))) {
        oldapicall = false;
    } else {
        CCPassword pwdtag = (CCPassword) getChild(ATTR_OLD_PASSWORD);
        pwdtag.setDisabled(true);
        oldapicall = true;
    }
    String[] arg = { AMFormatUtils.getIdentityDisplayName(model, userId) };
    ptModel.setPageTitleText(MessageFormat.format(model.getLocalizedString("page.title.user.change.password"), (Object[]) arg));
}
Also used : UMChangeUserPasswordModel(com.sun.identity.console.user.model.UMChangeUserPasswordModel) CCPassword(com.sun.web.ui.view.html.CCPassword)

Aggregations

CCPassword (com.sun.web.ui.view.html.CCPassword)2 View (com.iplanet.jato.view.View)1 UMChangeUserPasswordModel (com.sun.identity.console.user.model.UMChangeUserPasswordModel)1 EncodeAction (com.sun.identity.security.EncodeAction)1 CCEditableList (com.sun.web.ui.view.editablelist.CCEditableList)1 CCCheckBox (com.sun.web.ui.view.html.CCCheckBox)1 HashMap (java.util.HashMap)1