public PasswordRecoveryStep1(LoginFacade loginFacade) : base() { SubpageTitle = "Obnova hesla"; RabitBackgroundCssClass = "sf-bg-password-recovery"; this.loginFacade = loginFacade; }
public ActionResult AjaxChangePassword(FormCollection form) { string OldPassword = Request["OldPassword"].ToString(); string Password = Request["Password"].ToString(); string RePassword = Request["RePassword"].ToString(); //string salt = LoginFacade.GetCustomerPasswordSalt(CurrUser.UserID); //OldPassword = PasswordHelper.GetEncryptedPassword(HttpUtility.UrlDecode(OldPassword.Replace("+", "%2b")) + salt); // [2014/12/22 by Swika]增加支持第三方系统导入的账号的密码验证 var encryptMeta = LoginFacade.GetCustomerEncryptMeta(CurrUser.UserID); OldPassword = PasswordHelper.GetEncryptedPassword(HttpUtility.UrlDecode(OldPassword.Replace("+", "%2b")), encryptMeta); if (LoginFacade.CustomerLogin(CurrUser.UserID, OldPassword) == null) { return(Json("旧密码不正确", JsonRequestBehavior.AllowGet)); } else { string encryptPassword = string.Empty; string passwordSalt = string.Empty; PasswordHelper.GetNewPasswordAndSalt(ref Password, ref encryptPassword, ref passwordSalt); //重置密码 if (CustomerFacade.UpdateCustomerPassword(CurrUser.UserID, encryptPassword, passwordSalt)) { return(Json("s", JsonRequestBehavior.AllowGet)); } return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet)); } }
public ActionResult AjaxCheckShowAuthCode(string customerID) { bool verifycode = false; verifycode = LoginFacade.CheckShowAuthCode(customerID); return(Json(new { verifycode = verifycode })); }
public ActionResult AjaxLogin() { var model = new LoginVM(); this.TryUpdateModel <LoginVM>(model); //判断是否需要输入验证码 bool showAuthCode = LoginFacade.CheckShowAuthCode(model.CustomerID); if (showAuthCode) { string verifyCode = CookieHelper.GetCookie <String>("VerifyCode"); if (!String.Equals(verifyCode, model.ValidatedCode, StringComparison.InvariantCultureIgnoreCase)) { return(Json(new { type = "f", verifycode = "y", message = "验证码不正确" }, JsonRequestBehavior.AllowGet)); } } if (UserMgr.Login(model)) { return(Json(new { type = "s" }, JsonRequestBehavior.AllowGet)); } if (showAuthCode) { return(Json(new { type = "f", verifycode = "y", message = "登录账户名或密码不正确" }, JsonRequestBehavior.AllowGet)); } return(Json(new { type = "f", message = "登录账户名或密码不正确" }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 用户登录 /// </summary> /// <param name="userName"></param> /// <param name="pwd"></param> /// <param name="verifyCode"></param> /// <returns></returns> public static bool Login(LoginVM vm)//string userName, string pwd, string verifyCode) { //EncryptType encryptionStatus = EncryptType.Encryption; string newPassword = string.Empty; //string passwordSalt = string.Empty; //passwordSalt = LoginFacade.GetCustomerPasswordSalt(vm.CustomerID); //vm.Password = PasswordHelper.GetEncryptedPassword(HttpUtility.UrlDecode(vm.Password.Replace("+", "%2b")) + passwordSalt); // [2014/12/22 by Swika]增加支持第三方系统导入的账号的密码验证 var encryptMeta = LoginFacade.GetCustomerEncryptMeta(vm.CustomerID); vm.Password = PasswordHelper.GetEncryptedPassword(HttpUtility.UrlDecode(vm.Password.Replace("+", "%2b")), encryptMeta); CustomerInfo user = LoginFacade.CustomerLogin(vm.CustomerID, vm.Password); if (user != null) { LoginFacade.UpdateLastLoginTime(user.SysNo); LoginUser lUser = new LoginUser(); lUser.UserDisplayName = user.CustomerName; lUser.UserID = user.CustomerID; lUser.UserSysNo = user.SysNo; lUser.RememberLogin = vm.RememberLogin; lUser.LoginDateText = DateTime.Now.ToString(); lUser.TimeoutText = DateTime.Now.AddMinutes(int.Parse(ConfigurationManager.AppSettings["LoginTimeout"].ToString())).ToString(); WriteUserInfo(lUser); return(true); } return(false); }
private void Button1_Click(object sender, System.EventArgs e) { try { Oper oper = LoginFacade.IsUser(txtLoginID.Text, txtPwd.Text); // ArrayList list = Application["GLOBAL_USER_LIST"] as ArrayList; // if (list == null) // { // list = new ArrayList(); // } // for (int i = 0; i < list.Count; i++) // { // if (txtLoginID.Text == (list[i] as string)) // { // //厮将鞠村阻�戻幣危列佚連 // throw new Exception("緩喘薩厮将鞠村"); // } // } // list.Add(txtLoginID.Text); // Application["GLOBAL_USER_LIST"] = list; Session[ConstApp.S_OPER] = oper; Response.Redirect("wfmMain.aspx", false); } catch (Exception ex) { Popup(ex.Message); } }
private void AuthenticateIP() { dto.Login inLoginDto = GetPageValues(); LoginFacade facade = new LoginFacade(); dto.Login outLoginDto = facade.AuthenticateIP(inLoginDto); if (outLoginDto != null) { // For this sample, always set the persist flag to false. if (Request.QueryString["returnurl"] != null) { FormsAuthentication.RedirectFromLoginPage(outLoginDto.EmailAddress, false); } else { FormsAuthentication.SetAuthCookie(outLoginDto.EmailAddress, false); Response.Redirect(Pages.Home, false); } } else { LblIPAddress.Text = inLoginDto.IPAddress; } }
public ActionResult AjaxFindPasswordByPhone(FormCollection form) { string validatedCode = Request["ValidatedCode"].ToString(); if (CookieHelper.GetCookie <String>("VerifyCode").ToLower() == validatedCode.ToLower()) { string customerStr = Request["CustomerID"].ToString(); if (LoginFacade.IsExistCustomer(customerStr))//存在该用户名 { CustomerInfo customer = CustomerFacade.GetCustomerByID(customerStr); if (string.IsNullOrEmpty(customer.CellPhone)) { return(Json("不存在该用户的手机号码", JsonRequestBehavior.AllowGet)); } if (!CustomerFacade.CheckCustomerPhoneValided(customer.SysNo)) { return(Json("用户手机密码没有通过验证", JsonRequestBehavior.AllowGet)); } CookieHelper.SaveCookie <string>("FindPasswordCustomerID", customerStr); CookieHelper.SaveCookie <string>("FindPasswordCustomerCellPhone", customer.CellPhone); CookieHelper.SaveCookie <string>("FindPasswordCustomerSysNo", customer.SysNo.ToString()); return(Json(customer.CellPhone, JsonRequestBehavior.AllowGet)); } return(Json("不存在该用户", JsonRequestBehavior.AllowGet)); } return(Json("验证码不正确", JsonRequestBehavior.AllowGet)); }
private void txtGiris_Click(object sender, EventArgs e) { LoginFacade adminLogin = new LoginFacade(); bool successLogin = adminLogin.Kontrol(txtAdminName.Text, txtAdminPassword.Text); if (successLogin) { LoginMessage(successLogin); frmMain frmMain = new frmMain(); frmMain.Show(); this.Hide(); } else { LoginMessage(successLogin); } //var admin = new Admin() //{ // adminName = txtAdminPassword.Text, // adminPassword = txtAdminPassword.Text //}; //adminLogin.Ekle(admin); }
public Register(LoginFacade loginFacade) : base() { SubpageTitle = "Registrácia"; RabitBackgroundCssClass = "sf-bg-register"; this.loginFacade = loginFacade; }
public ActionResult AjaxCheckRegisterEmail(string CustomerEmail) { if (LoginFacade.IsCustomerEmailExist(CustomerEmail)) { return(Json("该邮箱已经被注册", JsonRequestBehavior.AllowGet)); } return(Json("s", JsonRequestBehavior.AllowGet)); }
public ActionResult AjaxCheckRegisterPhoneNumber(string CellPhoneNumber) { if (LoginFacade.IsCustomerPhoneExist_Confirm(CellPhoneNumber)) { return(Json("该手机号码已被绑定", JsonRequestBehavior.AllowGet)); } return(Json("s", JsonRequestBehavior.AllowGet)); }
public ActionResult AjaxCheckRegisterID(string CustomerID) { if (LoginFacade.IsExistCustomer(CustomerID)) { return(Json("该账户名已经被注册", JsonRequestBehavior.AllowGet)); } return(Json("s", JsonRequestBehavior.AllowGet)); }
public PasswordRecoveryStep2(LoginFacade loginFacade, PersonalProfileFacade personalProfileFacade) : base() { SubpageTitle = "Obnova hesla"; RabitBackgroundCssClass = "sf-bg-password-recovery"; this.loginFacade = loginFacade; this.personalProfileFacade = personalProfileFacade; }
public RegisterFinish(LoginFacade loginFacade, PersonalProfileFacade personalProfileFacade) : base() { SubpageTitle = "Dokončenie registrácie"; RabitBackgroundCssClass = "sf-bg-register"; this.loginFacade = loginFacade; this.personalProfileFacade = personalProfileFacade; }
private string PrepareToken(string username, string password) { //var userName = Request.Headers.Contains("username") ? Request.Headers.GetValues("uname").FirstOrDefault() : string.Empty; //var password = Request.Headers.Contains("pword") ? Request.Headers.GetValues("pword").FirstOrDefault() : string.Empty; ILoginFacade log = new LoginFacade(); return(log.VerifyLoginCredentials(username, password)); }
public void CanCreateNewAdmin() { LoginFacade.LoginAsAdmin(); var newAdmin = AdminUiFacade.AddAdmin(); AdminsManagementPage.Grid.AssertAdminIsPresent(newAdmin.Email); }
public PrincipalForm() { InitializeComponent(); TodoPagosContext context = new TodoPagosContext(); unitOfWork = new UnitOfWork(context); logStrategy = new LogDatabaseConcreteStrategy(unitOfWork); todoPagosFacade = new LoginFacade(unitOfWork); }
/// <summary> /// 第三方登录回调 /// </summary> /// <param name="identify">第三方标识</param> /// <param name="collection">回调参数</param> /// <returns></returns> public PartnerBackResult LoginBack(string identify, NameValueCollection collection) { PartnerBackContext context = new PartnerBackContext(); context.PartnerIdentify = identify; context.ResponseParam = collection; Partners partner = Partners.GetInstance(context); if (!partner.BackVerifySign(context)) { Logger.WriteLog(string.Format("第三方登录回调非法请求,第三方标识:{0}", identify), "Passport", "LoginBack"); throw new BusinessException("登录失败!"); } CustomerInfo customer = null; if (context.ActionType == PassportActionType.Accept) { partner.GetResponseUserInfo(context); customer = new CustomerInfo() { CustomerID = context.CustomerID, CustomerName = context.CustomerName, CustomersType = (int)context.CustomerSouce, InitRank = 1, Password = "", CellPhone = context.CellPhone, Email = context.Email }; var existsCustomer = CustomerFacade.GetCustomerByID(context.CustomerID); if (existsCustomer == null) { int customerSysNo = LoginFacade.CreateCustomer(customer).SysNo; if (customerSysNo <= 0) { Logger.WriteLog(string.Format("第三方登录回调注册用户失败,第三方标识:{0}", identify), "Passport", "LoginBack"); throw new BusinessException("第三方登录注册用户失败!"); } customer.SysNo = customerSysNo; } else { customer.SysNo = existsCustomer.SysNo; } } PartnerBackResult result = new PartnerBackResult() { Customer = customer, ReturnUrl = context.ReturnUrl, ActionType = context.ActionType }; return(result); }
public HttpResponseMessage GetLoggedIn(string value) { try { HttpResponseMessage response; MessageWrapper messageWrapper = JsonConvert.DeserializeObject <MessageWrapper>(Encrypt.DecryptString(value, "enigma")); if (new MessageWrapper <TokenUname>().MessageType == messageWrapper.MessageType) { TokenUname tokenUname = (TokenUname)messageWrapper.Message; KeyValuePair <int, TokenUname> loggedGamer = LoginFacade.LoginGamer(tokenUname.Token_Id); if (loggedGamer.Key == 200) { response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(JsonConvert.SerializeObject(loggedGamer.Value), Encoding.ASCII, "application/json") }; return(response); } else { response = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(JsonConvert.SerializeObject(loggedGamer.Value), Encoding.ASCII, "application/json") }; return(response); } } else { Type messageType = Type.GetType(messageWrapper.MessageType); var message = JsonConvert.DeserializeObject(Convert.ToString(messageWrapper.Message), messageType); LoginGamerInfo loginGamerInfo = (LoginGamerInfo)message; KeyValuePair <int, TokenUname> loggedGamer = LoginFacade.LoginGamer(loginGamerInfo.Uname, loginGamerInfo.Password, loginGamerInfo.RemMe); if (loggedGamer.Key == 200) { response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(JsonConvert.SerializeObject(loggedGamer.Value), Encoding.ASCII, "application/json") }; return(response); } else { response = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(JsonConvert.SerializeObject(loggedGamer.Value), Encoding.ASCII, "application/json") }; return(response); } } } catch (Exception ex) { throw ex; } }
public static CustomerInfoViewModel CustomerLogin(LoginViewModel request) { if (string.IsNullOrEmpty(request.CustomerID)) { throw new BusinessException("登录账号不能为空!"); } else if (string.IsNullOrEmpty(request.Password)) { throw new BusinessException("登录密码不能为空!"); } string newPassword = string.Empty; //string passwordSalt = string.Empty; //passwordSalt = LoginFacade.GetCustomerPasswordSalt(request.CustomerID); //request.Password = PasswordHelper.GetEncryptedPassword(HttpUtility.UrlDecode(request.Password.Replace("+", "%2b")) + passwordSalt); // [2014/12/22 by Swika]增加支持第三方系统导入的账号的密码验证 var encryptMeta = LoginFacade.GetCustomerEncryptMeta(request.CustomerID); try { request.Password = PasswordHelper.GetEncryptedPassword(HttpUtility.UrlDecode(request.Password.Replace("+", "%2b")), encryptMeta); var loginResult = LoginFacade.CustomerLogin(request.CustomerID, request.Password); if (null != loginResult) { CustomerInfoViewModel user = EntityConverter <CustomerInfo, CustomerInfoViewModel> .Convert(CustomerFacade.GetCustomerInfo(loginResult.SysNo), (s, t) => { t.RegisterTimeString = s.RegisterTime.ToString("yyyy年MM月dd日 HH:mm:ss"); t.AvtarImage = s.ExtendInfo.AvtarImage; t.AvtarImageDBStatus = s.ExtendInfo.AvtarImageDBStatus; }); if (user != null) { LoginFacade.UpdateLastLoginTime(user.SysNo); LoginUser lUser = new LoginUser(); lUser.UserDisplayName = user.CustomerName; lUser.UserID = user.CustomerID; lUser.UserSysNo = user.SysNo; lUser.RememberLogin = true; lUser.LoginDateText = DateTime.Now.ToString(); lUser.TimeoutText = DateTime.Now.AddMinutes(int.Parse(ConfigurationManager.AppSettings["LoginTimeout"].ToString())).ToString(); CookieHelper.SaveCookie <LoginUser>("LoginCookie", lUser); } System.Threading.Thread.Sleep(1000); return(user); } else { throw new BusinessException("登录失败,用户名或者密码错误!"); } } catch { throw new BusinessException("登录失败,用户名或者密码错误!"); } }
public ActionResult AjaxRegister() { var model = new RegisterVM(); this.TryUpdateModel <RegisterVM>(model); var result = new AjaxResult { Success = false }; //判断此CustomerID是否被注册过 if (LoginFacade.IsExistCustomer(model.CustomerID)) { result.Message = "该账户名已经被注册"; return(Json(result, JsonRequestBehavior.AllowGet)); } if (model.Password != model.RePassword) { result.Message = "密码与确认密码不相同"; return(Json(result, JsonRequestBehavior.AllowGet)); } model.Password = HttpUtility.UrlDecode(model.Password.Replace("+", "%2b")); CustomerInfo item = EntityConverter <RegisterVM, CustomerInfo> .Convert(model); item.InitRank = 1; item.CustomerName = item.CustomerID; //密码处理 string encryptPassword = string.Empty; string password = item.Password; string passwordSalt = string.Empty; PasswordHelper.GetNewPasswordAndSalt(ref password, ref encryptPassword, ref passwordSalt); item.Password = encryptPassword; item.PasswordSalt = passwordSalt; if (LoginFacade.CreateCustomer(item).SysNo > 0) { LoginUser lUser = new LoginUser(); lUser.UserDisplayName = item.CustomerName; lUser.UserID = item.CustomerID; lUser.UserSysNo = item.SysNo; lUser.RememberLogin = false; lUser.LoginDateText = DateTime.Now.ToString(); lUser.TimeoutText = DateTime.Now.AddMinutes(int.Parse(ConfigurationManager.AppSettings["LoginTimeout"].ToString())).ToString(); CookieHelper.SaveCookie <LoginUser>("LoginCookie", lUser); result.Success = true; return(Json(result, JsonRequestBehavior.AllowGet)); } result.Message = "用户注册失败,请稍后重试"; return(Json(result, JsonRequestBehavior.AllowGet)); }
public MyProfile(PersonalProfileFacade proFac, LoginFacade logFac, RoomReservationFacade resFac) { personalProfileFacade = proFac; loginFacade = logFac; roomReservationFacade = resFac; SubpageTitle = "Môj profil"; RabitBackgroundCssClass = "sf-bg-program"; ActiveTabId = 1; }
private void btnSignIn_Click(object sender, EventArgs e) { try { var login = new LoginFacade(txtUserName.text, txtPassword.text); login.Login(this); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void CanFindCheapestHotel() { LoginFacade.LoginAsDemoUser(); HomePage.Open(); var expectedHotel = new Hotel { Price = 20, Title = "Malmaison Manchester" }; HomePage.FeaturedHotels.AssertCheapestHotelIs(expectedHotel); }
public IHttpActionResult ResetPassword([FromBody] PasswordModel model) { var loginFacade = new LoginFacade(); var result = loginFacade.ResetPassword(model.Password, model.ValidationId, model.EmailAddress); if (result) { return(Ok()); } else { return(InternalServerError()); } }
public ActionResult LoginPost(MVCLogin login) { LoginFacade logfacade = new LoginFacade(); if (ModelState.IsValid) { login = logfacade.LoginGetEmployee(login); if (login.IsSuccess > 0) { FormsAuthentication.SetAuthCookie(login.UserName, false); return(RedirectToAction("Index", "Employee")); } } return(RedirectToAction("Login", login)); }
public void FailIfPasswordIsIncorrect() { var mockUnitOfWork = new Mock <IUnitOfWork>(); LoginFacade facade = new LoginFacade(mockUnitOfWork.Object); string email = "*****@*****.**"; string password = "******"; User cashierUser = new User("Cajero", "*****@*****.**", "Hola1234!", CashierRole.GetInstance()); IEnumerable <User> allUsers = new List <User> { cashierUser }; mockUnitOfWork.Setup(u => u.UserRepository.Get(It.IsAny <Expression <Func <User, bool> > >(), null, "")).Returns(new List <User>()); facade.AdminLogin(email, password); }
public void VerifyAndDeleteCandidate() { this.Browser.Navigate().GoToUrl(academyLink); var loginFacade = new LoginFacade(); loginFacade.Login(Browser, "ageorgieva", "{password}"); this.Browser.Navigate().GoToUrl(string.Concat(academyLink, "Administration_SoftwareAcademy/Candidates")); var candidateFasade = new CandidateAdminPanelFacade(); candidateFasade.VerifyCandidate(Browser); candidateFasade.DeleteCandidate(Browser, "*****@*****.**"); candidateFasade.VerifyCandidate(Browser); }
public void ApplayForSortwareAcademy() { this.Browser.Navigate().GoToUrl(academyLink); LoginFacade loginFacade = new LoginFacade(); loginFacade.Login(this.Browser, "ageorgieva", "{password}"); ApplyForAcademyFacade applyFacade = new ApplyForAcademyFacade(); applyFacade.NavigateToTheApplyingForm(this.Browser); applyFacade.PopulatePersonalData(this.Browser); applyFacade.PopulateAdditionalQuestions(this.Browser); applyFacade.PopulateDocuments(this.Browser); applyFacade.SubmitForm(this.Browser); }
public void MyTestInitialize() { #region WebAii Initialization // Initializes WebAii manager to be used by the test case. // If a WebAii configuration section exists, settings will be // loaded from it. Otherwise, will create a default settings // object with system defaults. // // Note: We are passing in a delegate to the VisualStudio // testContext.WriteLine() method in addition to the Visual Studio // TestLogs directory as our log location. This way any logging // done from WebAii (i.e. Manager.Log.WriteLine()) is // automatically logged to the VisualStudio test log and // the WebAii log file is placed in the same location as VS logs. // // If you do not care about unifying the log, then you can simply // initialize the test by calling Initialize() with no parameters; // that will cause the log location to be picked up from the config // file if it exists or will use the default system settings (C:\WebAiiLog\) // You can also use Initialize(LogLocation) to set a specific log // location for this test. // Pass in 'true' to recycle the browser between test methods ////Initialize(false, this.TestContext.TestLogsDir, new TestContextWriteLine(this.TestContext.WriteLine)); // If you need to override any other settings coming from the // config section you can comment the 'Initialize' line above and instead // use the following: // This will get a new Settings object. If a configuration // section exists, then settings from that section will be // loaded Settings settings = GetSettings(); // Override the settings you want. For example: settings.Web.DefaultBrowser = BrowserType.Chrome; settings.AnnotateExecution = true; settings.Web.RecycleBrowser = true; // Now call Initialize again with your updated settings object Initialize(settings, new TestContextWriteLine(this.TestContext.WriteLine)); // Set the current test method. This is needed for WebAii to discover // its custom TestAttributes set on methods and classes. // This method should always exist in [TestInitialize()] method. SetTestMethod(this, (string)TestContext.Properties["TestName"]); Manager.LaunchNewBrowser(); #endregion WebAii Initialization // // Place any additional initialization here // this.loginFacade = new LoginFacade(Username, Password); loginFacade.LogIn(); }