Fix to disallow quotes in usernames (as per Group names)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2477 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-02-23 11:33:14 +00:00
parent 8c30e51992
commit 622d6c4ac5
3 changed files with 11 additions and 3 deletions

View File

@@ -258,6 +258,7 @@ loggedout_details=You have been logged out of Alfresco.
relogin=Re-login to Alfresco
no_access=You have no access to Alfresco.
no_cookies=Cookies must be enabled in your browser for the Alfresco Web-Client to function correctly.
user_err_user_name=User ID cannot contain the characters: {0}
# Browse list messages
no_space_items=No items to display. Click the ''{0}'' action to create a space.

View File

@@ -240,13 +240,19 @@ public class LoginBean
public void validateUsername(FacesContext context, UIComponent component, Object value)
throws ValidatorException
{
String pass = (String) value;
if (pass.length() < 3 || pass.length() > 32)
String name = (String) value;
if (name.length() < 3 || name.length() > 32)
{
String err = MessageFormat.format(Application.getMessage(context, MSG_USERNAME_LENGTH),
new Object[]{3, 32});
throw new ValidatorException(new FacesMessage(err));
}
if (name.indexOf('\'') != -1 || name.indexOf('"') != -1 || name.indexOf('\\') != -1)
{
String err = MessageFormat.format(Application.getMessage(context, MSG_USER_ERR),
new Object[]{"', \", \\"});
throw new ValidatorException(new FacesMessage(err));
}
}
@@ -397,6 +403,7 @@ public class LoginBean
private static final String MSG_USERNAME_LENGTH = "login_err_username_length";
private static final String MSG_PASSWORD_CHARS = "login_err_password_chars";
private static final String MSG_PASSWORD_LENGTH = "login_err_password_length";
private static final String MSG_USER_ERR = "user_err_user_name";
public static final String LOGIN_REDIRECT_KEY = "_alfRedirect";
public static final String LOGIN_EXTERNAL_AUTH= "_alfExternalAuth";

View File

@@ -186,7 +186,7 @@
</a:panel>
<td class="separator" width=1></td>
<td width=110 valign=middle>
<td width=118 valign=middle>
<%-- View mode settings --%>
<a:modeList itemSpacing="4" iconColumnWidth="20" selectedStyleClass="statusListHighlight" disabledStyleClass="statusListDisabled" selectedImage="/images/icons/Details.gif"
value="#{BrowseBean.browseViewMode}" actionListener="#{BrowseBean.viewModeChanged}" menu="true" menuImage="/images/icons/menu.gif" styleClass="moreActionsMenu">