public UserAccount handleLogin(String name, String password){ //returns null if error
        if (name==null || password==null){ System.out.println("ERROR IN handleLogin"); return null; }
        UserAccount account = users.get(name.toLowerCase());
        if (account==null){ //if a new user accout must be created
            if (!name.matches("[A-Za-z][A-Za-z0-9_]+")) return null; //invalid username since it can only contain letters, numbers, and underscores
            account = new UserAccount(name, password, users.size(), false);
            users.put(name.toLowerCase(), account); //to make name mappings non-case-sensitive
            return account;
        }
        if (!account.getPassword().equals(password)) return null; //if user exists, but login fails
        if (account.getThread()!=null && account.getThread().isAlive()){ //if user is already logged in, and login succeeds
            account.getThread().disconnect("I am now signing in from a different location.");
        }
        if (account.getIsBanned()) return null;
        return account;
    }