示例#1
0
        private Exception CreateExceptionForFailedLoginAttempt(EddoLoginResultType result, string usernameOrEmailAddress, string tenancyName)
        {
            switch (result)
            {
            case EddoLoginResultType.Success:
                return(new ApplicationException("不要使用成功结果调用此方法!"));

            case EddoLoginResultType.InvalidUserNameOrEmailAddress:
            case EddoLoginResultType.InvalidPassword:
                return(new UserFriendlyException("登录异常", " 用户名或密码错误"));

            case EddoLoginResultType.InvalidTenancyName:
                return(new UserFriendlyException("登录异常", "租户不存在"));

            case EddoLoginResultType.TenantIsNotActive:
                return(new UserFriendlyException("登录异常", "租户没激活"));

            case EddoLoginResultType.UserIsNotActive:
                return(new UserFriendlyException("登录异常", "账号" + usernameOrEmailAddress + "没有激活"));

            case EddoLoginResultType.UserEmailIsNotConfirmed:
                return(new UserFriendlyException("登录异常", "邮箱没有确认不能登录"));

            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(new UserFriendlyException("登录失败"));
            }
        }
示例#2
0
 public EddoLoginResult(EddoLoginResultType result, TUser user = null)
 {
     Result = result;
     User   = user;
 }