 
 // INPUT VALIDATION FUNCTIONS ------------------------------------------
 
-// isInvalidUsername
-//
-// @param: email - String
-// @return: True if email is not a valid email.
+/**
+    isInvalidEmail
+
+    @param: email - String
+    @return: True if email is not a valid email.
+*/
 func isInvalidEmail(email:String) -> Bool {
     let emailRegex = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
     

    return !emailTest.evaluateWithObject(email)
}

// isInvalidUsername
//
// @param: username - String
// @return: True if username = empty, too long, or too short.
func isInvalidUsername(username: String) -> Bool {
    return (username.isEmpty ||
        username.characters.count > USERNAME_CHAR_MAX ||
        username.characters.count < USERNAME_CHAR_MIN)
}

// isInvalidPassword
//
// @param: password - String
// @return: True if password = empty, too long, or too short.
func isInvalidPassword(password: String) -> Bool {
    return (password.isEmpty ||
        password.characters.count > PASSWORD_CHAR_MAX ||


// SESSION VALIDATION FUNCTIONS ---------------------------------------

/**
    isUserLoggedIn

    @return: Bool - True if user is currently logged into a session
*/
func isUserLoggedIn() -> Bool {
    return NSUserDefaults.standardUserDefaults().boolForKey(IS_LOGGED_IN_KEY)
}

/**
    setUserSession

    @param: username - String - validated, existing username
    @param: password - String - validated, existing password
*/
func setUserSession(username: String, password: String) -> Void {
    // Store username and password in keychain:
    MyKeychainWrapper.mySetObject(password, forKey: kSecValueData)
