Exemplo n.º 1
0
        public async Task <LoginResult> Register(LoginManager manager)
        {
            LoginResult result;
            RegistrationValidationCode code = VerifyRegistrationData();

            if (code.Equals(RegistrationValidationCode.VALID))
            {
                result = await manager.Register(username, password, firstname, lastname);
            }
            else
            {
                result             = new LoginResult();
                result.Success     = false;
                result.ErrorString = RegistrationApplicant.GetInvalidCodeMessage(code);
            }

            return(result);
        }
Exemplo n.º 2
0
        public static string GetInvalidCodeMessage(RegistrationValidationCode code)
        {
            switch (code)
            {
            case RegistrationValidationCode.INVALID_USERNAME:
                return("You must enter a valid username.");

            case RegistrationValidationCode.INVALID_PASSWORD:
                return("You must enter a valid password.");

            case RegistrationValidationCode.INVALID_FIRSTNAME:
                return("You must enter a valid first name.");

            case RegistrationValidationCode.INVALID_LASTNAME:
                return("You must enter a valid last name.");

            case RegistrationValidationCode.INVALID_PASSWORD_MISMATCH:
                return("The entered passwords do not match.");

            default:
                return("");
            }
        }