本文整理匯總了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) );
}
}