当前位置: 首页>>代码示例>>C#>>正文


C# User.GetPassword方法代码示例

本文整理汇总了C#中umbraco.BusinessLogic.User.GetPassword方法的典型用法代码示例。如果您正苦于以下问题:C# User.GetPassword方法的具体用法?C# User.GetPassword怎么用?C# User.GetPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在umbraco.BusinessLogic.User的用法示例。


在下文中一共展示了User.GetPassword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateUser

        public static void ValidateUser(string login, string pass)
        {
            umbraco.BusinessLogic.User u = null;
            if (umbraco.UmbracoSettings.DefaultBackofficeProvider == "UsersMembershipProvider")
            {
                u = new User(login);
                if(u!= null && pass != u.GetPassword())
                    throw new Umbraco.Courier.Core.Exceptions.UnauthorizedClientException("User: " + login + " could not be authenticated");
            }
            else
            {
                if (Membership.Providers[umbraco.UmbracoSettings.DefaultBackofficeProvider].ValidateUser(login, pass))
                    u = new User(login);
                else
                    throw new Umbraco.Courier.Core.Exceptions.UnauthorizedClientException("User: " + login + " could not be authenticated");
            }

            if(u == null)
                throw new Umbraco.Courier.Core.Exceptions.UnauthorizedClientException("User: " + login + " does not exists");

                if (u.Disabled)
                    throw new Umbraco.Courier.Core.Exceptions.UnauthorizedClientException("User: " + login + " is not enabled");

                // CLN: Can not compare passwords from membership providers  -- Check is done
                //if (u.GetPassword() != pass)
                //    throw new Umbraco.Courier.Core.Exceptions.UnauthorizedClientException("User: " + login + " and password: xxx does not match");

                if (!Umbraco.Courier.Core.Configuration.Security.AllowAllUsers && Umbraco.Courier.Core.Configuration.Security.DeniedUsers.Contains(u.LoginName))
                    throw new Umbraco.Courier.Core.Exceptions.UnauthorizedClientException("User: " + login + " does not have access to courier");

                if (u.Applications.Where(x => x.alias.ToLower() == "courier").Count() == 0)
                    throw new Umbraco.Courier.Core.Exceptions.UnauthorizedClientException("User: " + login + " does not have access to courier.");
        }
开发者ID:jayvin,项目名称:Courier,代码行数:33,代码来源:SecurityHelper.cs

示例2: getloginAndPass

        //�Private�Methods�(2)
        private void getloginAndPass(int userId, ref string login, ref string pass)
        {
            //if we have a userID, we will use that...
            if (UserId >= 0)
            {
                var u = new User(UserId);

                //encrypt login and password
                login = Encryption.Encrypt(u.LoginName);
                pass = Encryption.Encrypt(u.GetPassword());
            }
            else
            {
                //we will fetch them from the set values
                login = Encryption.Encrypt(Login);
                pass = Encryption.Encrypt(encodePassWord(Password) );
            }
        }
开发者ID:jayvin,项目名称:Courier,代码行数:19,代码来源:CourierWebserviceRepositoryProvider.cs


注:本文中的umbraco.BusinessLogic.User.GetPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。