SSOLogin can now be set in UserEditForms
git-svn-id: https://svn.libreccm.org/ccm/trunk@6198 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
cc70b41ada
commit
042e4006e2
|
|
@ -126,6 +126,8 @@ class UserAddForm extends UserForm
|
|||
}
|
||||
auth.save();
|
||||
|
||||
auth.setSSOlogin((String) m_ssoLogin.getValue(state));
|
||||
|
||||
// Switch to browse tab.
|
||||
m_adminPanel.setTab(USER_TAB_BROWSE_INDEX, state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ class UserCreateSection extends UserForm implements AdminConstants, Resettable {
|
|||
// Save user authentication credentials.
|
||||
final UserAuthentication auth = UserAuthentication.createForUser(user);
|
||||
|
||||
auth.setSSOlogin((String) m_ssoLogin.getValue(state));
|
||||
|
||||
auth.setPassword((String) m_password.getValue(state));
|
||||
if (securityConfig.getEnableQuestion()) {
|
||||
auth.setPasswordQuestion((String) m_question.getValue(state));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.arsdigita.bebop.event.FormProcessListener;
|
|||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.kernel.EmailAddress;
|
||||
import com.arsdigita.kernel.PersonName;
|
||||
import com.arsdigita.kernel.UserAuthentication;
|
||||
import com.arsdigita.kernel.User;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -82,6 +83,9 @@ class UserEditForm extends UserForm
|
|||
|
||||
m_screenName.setValue(state, user.getScreenName());
|
||||
|
||||
final UserAuthentication auth = UserAuthentication.retrieveForUser(user);
|
||||
m_ssoLogin.setValue(state, auth.getSSOlogin());
|
||||
|
||||
USER_FORM_LABEL_ADDITIONAL_EMAIL_LIST.setVisible(state, true);
|
||||
m_emailList.setVisible(state, true);
|
||||
}
|
||||
|
|
@ -139,6 +143,10 @@ class UserEditForm extends UserForm
|
|||
|
||||
user.save();
|
||||
|
||||
final UserAuthentication auth = UserAuthentication.retrieveForUser(user);
|
||||
auth.setSSOlogin((String) m_ssoLogin.getValue(state));
|
||||
auth.save();
|
||||
|
||||
m_browsePane.displayUserInfoPanel(state);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
protected TextField m_url;
|
||||
protected TextField m_screenName;
|
||||
protected EmailList m_emailList;
|
||||
protected TextField m_ssoLogin;
|
||||
private final PasswordValidationListener m_pwListener;
|
||||
private final NotEmptyValidationListener m_notNullListener;
|
||||
private final SecurityConfig securityConfig = SecurityConfig.getConfig();
|
||||
|
|
@ -77,12 +78,10 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
|
||||
addValidationListener(this);
|
||||
|
||||
|
||||
// Bug #163373 add length checking for first/last names. We
|
||||
// do this with both maximum length parameters in the user/add
|
||||
// form and with validation of the value that come in for
|
||||
// processing.
|
||||
|
||||
int max = 60;
|
||||
|
||||
m_firstName = new TextField(
|
||||
|
|
@ -101,7 +100,8 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
m_lastName.setMaxLength(max);
|
||||
m_lastName.setSize(25);
|
||||
m_lastName.addValidationListener(new NotEmptyValidationListener());
|
||||
m_lastName.addValidationListener(new StringLengthValidationListener(max));
|
||||
m_lastName
|
||||
.addValidationListener(new StringLengthValidationListener(max));
|
||||
|
||||
add(USER_FORM_LABEL_LAST_NAME);
|
||||
add(m_lastName);
|
||||
|
|
@ -119,8 +119,8 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
add(m_confirmPassword);
|
||||
|
||||
// Password question
|
||||
m_question =
|
||||
new TextField(new StringParameter(USER_FORM_INPUT_QUESTION));
|
||||
m_question
|
||||
= new TextField(new StringParameter(USER_FORM_INPUT_QUESTION));
|
||||
m_question.setSize(50);
|
||||
|
||||
if (securityConfig.getEnableQuestion()) {
|
||||
|
|
@ -165,6 +165,11 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
add(USER_FORM_LABEL_SCREEN_NAME);
|
||||
add(m_screenName);
|
||||
|
||||
m_ssoLogin = new TextField(new StringParameter(USER_FORM_INPUT_SSO));
|
||||
m_ssoLogin.setSize(50);
|
||||
add(USER_FORM_LABEL_SSO);
|
||||
add(m_ssoLogin);
|
||||
|
||||
// URL
|
||||
m_url = new TextField(new URLParameter(USER_FORM_INPUT_URL));
|
||||
m_url.setSize(50);
|
||||
|
|
@ -179,10 +184,10 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate the form. Verifies that the password and
|
||||
* password-confirm fields match. If not it adds an error to the
|
||||
* password-confirm field. Also verifies that primary email
|
||||
* address and screen name are unique amoung all users.
|
||||
* Validate the form. Verifies that the password and password-confirm fields
|
||||
* match. If not it adds an error to the password-confirm field. Also
|
||||
* verifies that primary email address and screen name are unique amoung all
|
||||
* users.
|
||||
*/
|
||||
@Override
|
||||
public void validate(FormSectionEvent event)
|
||||
|
|
@ -268,9 +273,9 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
}
|
||||
|
||||
/**
|
||||
* If this query returns with any rows we have a duplicate
|
||||
* screen name, email address, or both. Check the results and
|
||||
* produce appropriate error messages.
|
||||
* If this query returns with any rows we have a duplicate screen name,
|
||||
* email address, or both. Check the results and produce appropriate
|
||||
* error messages.
|
||||
*/
|
||||
while (query.next()) {
|
||||
if (screenName != null && screenName.equals(query.get("screenName"))) {
|
||||
|
|
@ -319,4 +324,5 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
m_answer.setVisible(state, isVisible);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,30 +37,31 @@ import com.arsdigita.bebop.event.FormSectionEvent;
|
|||
import com.arsdigita.bebop.form.Hidden;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.kernel.UserAuthentication;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Edits a user. If returnURL is passed in to the form, then redirects to
|
||||
* that URL; otherwise redirects to the user workspace.
|
||||
* Edits a user. If returnURL is passed in to the form, then redirects to that
|
||||
* URL; otherwise redirects to the user workspace.
|
||||
*
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
*
|
||||
* @version $Id: UserEditForm.java 738 2005-09-01 12:36:52Z sskracic $
|
||||
*
|
||||
**/
|
||||
*
|
||||
*/
|
||||
public class UserEditForm extends UserForm
|
||||
implements FormProcessListener
|
||||
{
|
||||
implements FormProcessListener {
|
||||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(UserEditForm.class);
|
||||
private static final Logger s_log = Logger.getLogger(UserEditForm.class);
|
||||
|
||||
private UserAuthenticationListener m_listener =
|
||||
new UserAuthenticationListener();
|
||||
private UserAuthenticationListener m_listener
|
||||
= new UserAuthenticationListener();
|
||||
private Hidden m_returnURL;
|
||||
private RequestLocal m_user = new RequestLocal() {
|
||||
|
||||
public Object initialValue(PageState ps) {
|
||||
User result;
|
||||
try {
|
||||
|
|
@ -70,6 +71,7 @@ public class UserEditForm extends UserForm
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public UserEditForm() {
|
||||
|
|
@ -78,8 +80,8 @@ public class UserEditForm extends UserForm
|
|||
addProcessListener(this);
|
||||
|
||||
// export return URL
|
||||
m_returnURL = new Hidden(new URLParameter
|
||||
(LoginHelper.RETURN_URL_PARAM_NAME));
|
||||
m_returnURL = new Hidden(new URLParameter(
|
||||
LoginHelper.RETURN_URL_PARAM_NAME));
|
||||
m_returnURL.setPassIn(true);
|
||||
add(m_returnURL);
|
||||
}
|
||||
|
|
@ -120,7 +122,6 @@ public class UserEditForm extends UserForm
|
|||
// user.addEmailAddress
|
||||
// (new EmailAddress(additional.getAddress()));
|
||||
//}
|
||||
|
||||
// Bug #166274: Unexpected behavior when editing
|
||||
// primary email.
|
||||
//
|
||||
|
|
@ -128,7 +129,6 @@ public class UserEditForm extends UserForm
|
|||
// changed, and if so set it to the new value and
|
||||
// delete the association with the old. If it
|
||||
// hasn't change don't do anything.
|
||||
|
||||
EmailAddress oaddr = user.getPrimaryEmail();
|
||||
EmailAddress naddr = new EmailAddress(data.get(FORM_EMAIL).toString());
|
||||
if (!oaddr.equals(naddr)) {
|
||||
|
|
@ -139,8 +139,11 @@ public class UserEditForm extends UserForm
|
|||
|
||||
user.save();
|
||||
|
||||
// redirect to workspace or return URL, if specified
|
||||
final UserAuthentication auth = UserAuthentication.retrieveForUser(user);
|
||||
auth.setSSOlogin((String) m_ssoLogin.getValue(state));
|
||||
auth.save();
|
||||
|
||||
// redirect to workspace or return URL, if specified
|
||||
final HttpServletRequest req = state.getRequest();
|
||||
|
||||
// final String path = LegacyInitializer.getFullURL
|
||||
|
|
@ -151,4 +154,5 @@ public class UserEditForm extends UserForm
|
|||
|
||||
throw new ReturnSignal(req, fallback);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ public abstract class UserForm extends Form
|
|||
protected TextField m_question;
|
||||
protected TextField m_answer;
|
||||
protected TextField m_url;
|
||||
protected TextField m_ssoLogin;
|
||||
|
||||
protected Label m_securitySectionHeader = new Label(LoginHelper
|
||||
.getMessage("login.userNewForm.securitySectionHeader"), false);
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ public class UserNewForm extends UserForm
|
|||
final String answer = (String)m_answer.getValue(state);
|
||||
final String firstName = (String)m_firstName.getValue(state);
|
||||
final String lastName = (String)m_lastName.getValue(state);
|
||||
final String ssoLogin = (String) m_ssoLogin.getValue(state);
|
||||
String sn = null;
|
||||
if (!Kernel.getConfig().emailIsPrimaryIdentifier()) {
|
||||
sn = (String)m_screenName.getValue(state);
|
||||
|
|
@ -183,6 +184,7 @@ public class UserNewForm extends UserForm
|
|||
auth.setPassword(password);
|
||||
auth.setPasswordQuestion(question);
|
||||
auth.setPasswordAnswer(answer);
|
||||
auth.setSSOlogin(ssoLogin);
|
||||
auth.save();
|
||||
} catch (PersistenceException e) {
|
||||
// problem with creating new User or retrieving
|
||||
|
|
|
|||
Loading…
Reference in New Issue