本文整理汇总了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.");
}
示例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) );
}
}