コード例 #1
0
        public static string ErrorCodeToString(MembershipActiviationStatus status)
        {
            switch (status)
            {
            case MembershipActiviationStatus.InvalidUsername:
                return("The user name provided is invalid. Please check the value and try again.");

            case MembershipActiviationStatus.InvalidActivationCode:
                return("The activation code provided is invalid. Please check the value and try again.");

            case MembershipActiviationStatus.ProviderError:
                return("The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator.");

            default:
                return("An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator.");
            }
        }
コード例 #2
0
        public User ActivateUser(string username, string activationCode, out MembershipActiviationStatus status)
        {
            if (!_dataService.IsValidAuthenticationCode(username, activationCode))
            {
                status = MembershipActiviationStatus.InvalidActivationCode;
                return(null);
            }

            var user = _dataService.ActivateUser(username, activationCode);

            if (user != null)
            {
                status = MembershipActiviationStatus.Success;
                return(user);
            }

            status = MembershipActiviationStatus.ProviderError;
            return(null);
        }
コード例 #3
0
 public static string ErrorCodeToString(MembershipActiviationStatus status)
 {
     switch (status)
     {
         case MembershipActiviationStatus.InvalidUsername:
             return "The user name provided is invalid. Please check the value and try again.";
         case MembershipActiviationStatus.InvalidActivationCode:
             return "The activation code provided is invalid. Please check the value and try again.";
         case MembershipActiviationStatus.ProviderError:
             return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator.";
         default:
             return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator.";
     }
 }
コード例 #4
0
        public User ActivateUser(string username, string activationCode, out MembershipActiviationStatus status)
        {
            if (!_dataService.IsValidAuthenticationCode(username, activationCode))
            {
                status = MembershipActiviationStatus.InvalidActivationCode;
                return null;
            }

            var user = _dataService.ActivateUser(username, activationCode);

            if (user != null)
            {
                status = MembershipActiviationStatus.Success;
                return user;
            }

            status = MembershipActiviationStatus.ProviderError;
            return null;
        }