protected void LogIn(object sender, EventArgs e) { if (this.Page.IsValid) { var owinCtx = Context.GetOwinContext(); var model = new LoginModel() { Email = this.Email.Text, Password = this.Password.Text }; var eventArgs = new LoginPageEventtArgs(model, owinCtx); this.EventLoginUser(this, eventArgs); SignInStatus result = this.Model.LoggedInStatus; switch (result) { case SignInStatus.Success: IdentityHelper.RedirectToReturnUrl("/", Response); break; case SignInStatus.Failure: default: FailureText.Text = "Грешно потребителско име или парола"; ErrorMessage.Visible = true; break; } } }
private void UserLogin(object sender, LoginPageEventtArgs e) { var manager = e.OwinCtx.GetUserManager <ApplicationUserManager>(); var signinManager = e.OwinCtx.GetUserManager <ApplicationSignInManager>(); var result = signinManager.PasswordSignIn(e.Data.Email, e.Data.Password, false, shouldLockout: false); this.View.Model.LoggedInStatus = result; }