/// <summary> /// 验证用户 /// </summary> void Authenticate() { IAccountHelper AccountHelper = AccountFactory.CreateInstance(); Account act = AccountHelper.GetAccountByLoginName(Name); if (act == null) { Message = "该用户不存在!"; return; } if (!AccountHelper.IsValidPassword(act, Password)) { Message = "密码不正确!"; return; } Security.SetAccountID(act.ID); }
void Signin() { string name = Request["UserName"]; string password = Request["Password"]; if (String.Compare(name, SiteConfigs.GetConfig().AdministratorName, true) == 0 && CDHelper.AdminPasswordIsValid(password)) { Security.SetAccountID(We7Helper.EmptyGUID); } else { IAccountHelper helper = AccountFactory.CreateInstance(); Account account = helper.GetAccountByLoginName(name); if (account != null && helper.IsValidPassword(account, password)) { Security.SetAccountID(account.ID); } } }