public static bool Register(UserDataFetcher UDF, string username, string email, string password, string passwordRepeat) { error.no = ErrorCode.OK; //valid username password if (!InputValidator.ValidateUsername(username)) { return(error.SetErrorAndReturnFalse( InputValidator.error.no | ErrorCode.INVALID_USERNAME)); } if (!InputValidator.ValidatePassword(password, passwordRepeat)) { return(error.SetErrorAndReturnFalse( InputValidator.error.no | ErrorCode.INVALID_PASSWORD)); //#trigger pass } //valid email System.Net.Mail.MailAddress mail; if (!InputValidator.ValidateEmail(email, out mail)) { return(error.SetErrorAndReturnFalse(ErrorCode.INVALID_EMAIL)); } //taken email username if (!InputValidator.CheckEmailNotTaken(UDF, mail)) { return(error.SetErrorAndReturnFalse(ErrorCode.EMAIL_TAKEN)); } if (!InputValidator.CheckUsernameNotTaken(UDF, username)) { return(error.SetErrorAndReturnFalse(ErrorCode.USERNAME_TAKEN)); } //hash and retrieve used salt string hashedPass = hasher.Hash(password, saveUsedSalt: true); //^named argument string usedSalt = hasher.GetLastUsedSaltAndForgetIt(); //push user UserDataPusher.PushNewUser(username, mail, hashedPass, usedSalt); //was it successful? if (InputValidator.CheckUsernameNotTaken(UDF, username)) { return(error.SetErrorAndReturnFalse(ErrorCode.PUSH_ERROR)); } return(true); }