public string CreateLocalizedMessageForFailedLoginAttempt(StudioXLoginResultType result, string usernameOrEmailAddress, string tenancyName)
        {
            switch (result)
            {
            case StudioXLoginResultType.Success:
                throw new Exception("Don't call this method with a success result!");

            case StudioXLoginResultType.InvalidUserNameOrEmailAddress:
            case StudioXLoginResultType.InvalidPassword:
                return(L("InvalidUserNameOrPassword"));

            case StudioXLoginResultType.InvalidTenancyName:
                return(L("ThereIsNoTenantDefinedWithName{0}", tenancyName));

            case StudioXLoginResultType.TenantIsNotActive:
                return(L("TenantIsNotActive", tenancyName));

            case StudioXLoginResultType.UserIsNotActive:
                return(L("UserIsNotActiveAndCanNotLogin", usernameOrEmailAddress));

            case StudioXLoginResultType.UserEmailIsNotConfirmed:
                return(L("UserEmailIsNotConfirmedAndCanNotLogin"));

            default:     //Can not fall to default actually. But other result types can be added in the future and we may forget to handle it
                Logger.Warn("Unhandled login fail reason: " + result);
                return(L("LoginFailed"));
            }
        }
Пример #2
0
 public StudioXLoginResult(StudioXLoginResultType result, TTenant tenant = null, TUser user = null)
 {
     Result = result;
     Tenant = tenant;
     User   = user;
 }