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


C# Usr.SetPassword方法代码示例

本文整理汇总了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.";
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:11,代码来源:ChangePassword.ascx.cs

示例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;
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:82,代码来源:Usr.cs

示例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);

//.........这里部分代码省略.........
开发者ID:davelondon,项目名称:dontstayin,代码行数:101,代码来源:Login.ascx.cs


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