public async Task <JsonResult> OnGetLogin(string Email, string Pwd) { var result = new JsonResult(false); var s = new BLL_School(); var u = new BLL_User(); var school = await s.LoadSchool(Email); if (school.SchoolName != null && school.SchoolName.Length > 0) { Globals.ConfigureSchoolDatabase(school.ServerName, school.DatabaseName); string encryptedEmail = Security.Encrypt(Email); var user = await u.LoadUser(encryptedEmail); if (user.UserId > 0) { var auth = Security.HashWithSalt(Pwd, user.Salt); if (auth == user.Pwd) { var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, Email) }, CookieAuthenticationDefaults.AuthenticationScheme); var principal = new ClaimsPrincipal(identity); var login = HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal); result = new JsonResult(true); } } } return(result); }
private void FormAdmin_Load(object sender, EventArgs e) { rb = new List <RadioButton>(); rb.Add(rb_admin); rb.Add(rb_banHang); rb.Add(rb_congNo); rb.Add(rb_kho); rb.Add(rb_nhanSu); rb.Add(rb_pkh); rb.Add(rb_no); BLL_User.LoadUser(tw_ds); }
private void FormAdmin_Activated(object sender, EventArgs e) { BLL_User.LoadUser(tw_ds); }