當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。