Example #1
0
        public async Task <Tuple <bool, string> > GetRegResponse(string email, string verificationCode, string password, string confirmPassword)
        {
            Tuple <bool, string> res = null;

            RegisterUser u = new RegisterUser(email, verificationCode, password, confirmPassword);

            if (u.IsValid())
            {
                bool isSuccess = await loginServices.RegisterAsync(u.Email, u.VerificationCode, u.Password, u.ConfirmPassword);

                if (isSuccess)
                {
                    res = new Tuple <bool, string>(true, "Registration has been successful.");
                }
                else
                {
                    res = new Tuple <bool, string>(false, "Registration failed at the server");
                }
            }
            else
            {
                if (u.HasBlanks())
                {
                    res = new Tuple <bool, string>(false, "Registration failed. Registration information incomplete.");
                }
                else if (u.InValidEmail())
                {
                    res = new Tuple <bool, string>(false, "Registration failed. Please enter a valid email address.");
                }
                else if (u.PasswordMisMatch())
                {
                    res = new Tuple <bool, string>(false, "Registration failed. Passwords do not match.");
                }
            }

            return(res);
        }