Project

General

Profile

« Previous | Next » 

Revision 51694

Change regular expression for valid username - Don't allow usernames that begin with period, underscore, hyphen

View differences:

LDAPActions.java
47 47

  
48 48
    public Entry createUser(String username, String email, String firstName, String lastName, String institution, String password) throws Exception {
49 49

  
50
        if(!username.matches("^[a-zA-Z0-9\\.\\_\\-]{4,150}")){
50
        if(!username.matches("^[a-zA-Z0-9][a-zA-Z0-9\\.\\_\\-]{4,150}")){
51 51
            throw new CustomLDAPException("Invalid username!");
52 52
        }
53 53

  
......
196 196

  
197 197
    public Entry createZombieUser(String username, String email, String firstName, String lastName, String institution, String password) throws Exception {
198 198

  
199
        if(!username.matches("^[a-zA-Z0-9\\.\\_\\-]{4,150}")){
199
        if(!username.matches("^[a-zA-Z0-9][a-zA-Z0-9\\.\\_\\-]{4,150}")){
200 200
            throw new CustomLDAPException("Invalid username!");
201 201
        }
202 202

  

Also available in: Unified diff