コード例 #1
0
        public async Task <Tuple <bool, string> > GetLoginResponse(string email, string password)
        {
            Tuple <bool, string> res = null;

            LoginUser u = new LoginUser(email, password);

            if (u.IsValid())
            {
                bool bSuccess = await loginServices.LoginAsync(u.Email, u.Password);

                if (bSuccess)
                {
                    res = new Tuple <bool, string>(true, "Login has been successful.");
                }
                else
                {
                    res = new Tuple <bool, string>(false, "Login failed. Incorrect email and/or password.");
                }
            }
            else
            {
                if (u.HasBlanks())
                {
                    res = new Tuple <bool, string>(false, "Login failed. Login information incomplete.");
                }
                else if (u.InValidEmail())
                {
                    res = new Tuple <bool, string>(false, "Login failed. Please enter a valid email address.");
                }
            }

            return(res);
        }