import java.util.*; // For Date

public class UBLogin {
	
	public UBLogin() {
	}

	public UBUser checkLogin(String username, String password) {
		if (username.equals("guest")) {
			return new UBUser();
		} else if (!username.equals("")) {
			/*
			 * Connect to the underlying storage and fetch the user matching
			 * the credentials, or none if no such user exists.
			 *
			 * If there is a matching user, assign the user id and other
			 * stored data.
			 *
			 * If we could only use an SQL database...
			 */
			boolean[] flags = new boolean[UBUser.USER_NUM_FLAGS];
			flags[UBUser.USER_FLAG_GUEST] = false;
			flags[UBUser.USER_FLAG_STUDENT] = true;
			return new UBUser(2, username, password, new Date(), new Date(), new Date(), null, flags);
		}

		return null;
	}
}