本文整理汇总了C#中Bobs.Usr.SetPassword方法的典型用法代码示例。如果您正苦于以下问题:C# Usr.SetPassword方法的具体用法?C# Usr.SetPassword怎么用?C# Usr.SetPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bobs.Usr
的用法示例。
在下文中一共展示了Usr.SetPassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Change
protected void Change(object sender, EventArgs e)
{
Usr u = new Usr(int.Parse(UsrK.Text));
if (!u.IsAdmin)
{
u.SetPassword(UsrPassword.Text, true);
OutLabel.Text = "Done.";
}
else
OutLabel.Text = "Can't change an admin password on this page.";
}
示例2: CreateNewUsrMaster
//public static bool GetCompliantUniqueNickName(string inNickName, out string outNickName)
//{
// outNickName = inNickName;
// int index;
// // if it's an email address, remove domain
// if (index = outNickName.IndexOf("@") > 0)
// {
// outNickName = outNickName.Substring(0, outNickName.IndexOf(index));
// }
// outNickName = Usr.GetCompliantNickName(outNickName);
// if (!Usr.NickNameRegex.IsMatch(outNickName))
// return false;
// else
// {
// Query q = new Query();
// q.QueryCondition = new Q(Usr.Columns.NickName, outNickName);
// q.ReturnCountOnly = true;
// UsrSet us = new UsrSet(q);
// us.Count == 0;
// }
//}
#endregion
#region CreateNewUsr
//public static Usr CreateNewUsr(string email, string password)
//{
// return CreateNewUsr(email, password, "", "");
//}
//public static Usr CreateNewUsr(string email, string password, string firstName, string lastName)
//{
// return CreateNewUsr(email, password, firstName, lastName, "");
//}
//public static Usr CreateNewUsr(string email, string password, string firstName, string lastName, string emailIp)
//{
// return CreateNewUsr(email, password, firstName, lastName, emailIp, true);
//}
public static Usr CreateNewUsrMaster(string email, string password, string firstName, string lastName, string emailIp, bool runUpdate)
{
Usr u = new Usr();
Random r = new Random();
#region Add data from form
u.DateTimeSignUp = Time.Now;
u.DateTimeLastAccess = Time.Now;
u.DateTimeLastPageRequest = Time.Now;
u.Email = email.Trim();
u.EmailDateTime = Time.Now;
u.EmailIp = emailIp;
if (password.Trim().Length > 0)
u.SetPassword(password.Trim(), false);
u.LoginString = Cambro.Misc.Utility.GenRandomText(6, r);
u.RandomNumber = r.NextDouble();
u.IsEmailVerified = false;
u.IsAdmin = false;
u.LoginCount = 0;
u.FirstName = firstName;
u.LastName = lastName;
u.NickName = "";
u.IsSkeleton = true;
u.SendSpottedEmails = true;
u.UpdateLargeEvents = 5000;
u.UpdateSendBuddies = false;
u.UpdateSendGenericMusic = true;
u.SendSpottedTexts = true;
u.SendFlyers = true;
u.SendInvites = true;
u.SendPartnerEmails = false;
u.SendPartnerTexts = false;
#endregion
if (runUpdate)
u.Update();
return u;
}
示例3: NoFacebookLogin
public static Hashtable NoFacebookLogin(
string nickNameOrEmail,
string password,
Hashtable captchaData,
Hashtable noFacebookSignupPanelData,
Hashtable detailsPanelData,
bool autoLogin,
int autoLoginUsrK,
string autoLoginString)
{
Hashtable ret = new Hashtable();
Usr u = null;
if (!autoLogin)
{
if (nickNameOrEmail.Trim().Length == 0)
{
ret["Error"] = true;
return ret;
}
Q q = null;
if (nickNameOrEmail.Contains("@"))
q = new Q(Usr.Columns.Email, nickNameOrEmail.Trim());
else
q = new Q(Usr.Columns.NickName, nickNameOrEmail.Trim());
UsrSet us = new UsrSet(new Query(q));
if (us.Count == 0)
{
ret["Error"] = true;
return ret;
}
u = us[0];
if (u.HasNullPassword)
{
u.SendPasswordResetLink();
ret["Error"] = true;
ret["HasNullPassword"] = true;
return ret;
}
if (!u.CheckPassword(password.Trim()))
{
ret["Error"] = true;
return ret;
}
}
else
{
if (autoLoginUsrK == 0 || autoLoginString.Length == 0)
{
ret["Error"] = true;
return ret;
}
try
{
u = new Usr(autoLoginUsrK);
}
catch
{
ret["Error"] = true;
return ret;
}
if (u.LoginString.ToLower() != autoLoginString.ToLower())
{
ret["Error"] = true;
return ret;
}
if (u.IsSkeleton)
{
string passwordFromAutoLoginSkeletonData = noFacebookSignupPanelData["Password"].ToString();
if (passwordFromAutoLoginSkeletonData.Length > 0)
{
if (passwordFromAutoLoginSkeletonData.Length < 4)
throw new Exception("Password too short");
u.SetPassword(passwordFromAutoLoginSkeletonData, false);
}
}
}
bool passedCaptcha = false;
if (!captchaIsOk(u, u.Email, ret, captchaData, ref passedCaptcha))
return ret;
if (passedCaptcha)
{
u.NeedsCaptcha = false;
u.PassedCaptcha = true;
}
noFacebookLogin(u, ret, noFacebookSignupPanelData, detailsPanelData);
//.........这里部分代码省略.........