예제 #1
0
        private static Login_Result BadUsernameResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {
                Login_Status = Login_Result.LoginStatus.Login_Fail
            };

            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field   = "Username",
                    Message = TMConfig.Current.TMErrorMessages.UserNameDoNotExistErrorMessage
                });
            }
            else
            {
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;
            }
            return(response);
        }
예제 #2
0
        private static Login_Result AccountDisabledResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {
                Login_Status = Login_Result.LoginStatus.Validation_Failed
            };

            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field   = "UserEnabled",
                    Message = TMConfig.Current.TMErrorMessages.AccountDisabledErrorMessage
                });
            }
            else
            {
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;
            }
            return(response);
        }
예제 #3
0
        private static Login_Result BadPasswordResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {
                Login_Status = Login_Result.LoginStatus.Login_Fail
            };

            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field   = "Password",
                    Message = TMConfig.Current.TMErrorMessages.Login_PasswordDoNotMatch
                });
            }
            else
            {
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;
            }

            return(response);
        }
 private static Login_Result BadUsernameResponse(TMConfig tmConfig)
 {
     var response = new Login_Result {Login_Status = Login_Result.LoginStatus.Login_Fail};
     if (tmConfig.showDetailedErrorMessages())
     {
         response.Validation_Results.Add(new Validation_Results
         {
             Field = "Username",
             Message = TMConfig.Current.TMErrorMessages.UserNameDoNotExistErrorMessage
         });
     }
     else
     {
         response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;
     }
     return response;
 }
        private static Login_Result BadPasswordResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {Login_Status = Login_Result.LoginStatus.Login_Fail};
            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field = "Password",
                    Message = TMConfig.Current.TMErrorMessages.Login_PasswordDoNotMatch
                });
            }
            else
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;

            return response;
        }
        private static Login_Result AccountExpiredResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {Login_Status = Login_Result.LoginStatus.Validation_Failed};
            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field = "ExpirationDate",
                    Message = TMConfig.Current.TMErrorMessages.AccountExpiredErrorMessage
                });
            }
            else
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;

            return response;
        }
예제 #7
0
        private static Signup_Result ValidationFailed(TMConfig config, NewUser newUser)
        {
            var sigupResponse = new Signup_Result();
            var validationList = newUser.validate();
            sigupResponse.Signup_Status = Signup_Result.SignupStatus.Validation_Failed;
            sigupResponse.UserCreated = 0;
            if (config.showDetailedErrorMessages())
            {
                foreach (var validation in validationList)
                {
                    var field = validation.MemberNames.FirstOrDefault();

                    sigupResponse.Validation_Results.Add(new Validation_Results
                    {
                        Field = field,
                        Message = validation.ErrorMessage
                    });
                }
            }
            else
                sigupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
            return  sigupResponse;
        }
예제 #8
0
        private static Signup_Result ValidateUserName(TMConfig config)
        {
            var signupResponse = new Signup_Result
            {
                Signup_Status = Signup_Result.SignupStatus.Validation_Failed,
                UserCreated = 0
            };
            if (config.showDetailedErrorMessages())
            {
                signupResponse.Validation_Results.Add(new Validation_Results { Field = "Username", Message = TMConfig.Current.TMErrorMessages.SignUpUsernameAlreadyExist });
            }
            else
            {
                signupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
            }

            return signupResponse;
        }
예제 #9
0
 private static Signup_Result UserTags_Validation(TMConfig config, UserTag tag)
 {
     var signupResponse = new Signup_Result();
     var validationList = tag.validate();
     signupResponse.Signup_Status = Signup_Result.SignupStatus.Validation_Failed;
     signupResponse.UserCreated = 0;
     if (!config.showDetailedErrorMessages())
     {
         signupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
     }
     else
     {
         foreach (var validation in validationList)
         {
             signupResponse.Validation_Results.Add(new Validation_Results { Field = validation.ToString(), Message = validation.ErrorMessage });
         }
     }
     return signupResponse;
 }