public CUser DoLogin(string username, string password) { CUser user = new CUser(); if (user.Login(username, password)) { return(user); } else { return(null); } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { try { CUser c = new CUser(); c.Login(txtEmail.Text, txtPass.Password.ToString()); MainWindow main = new MainWindow(); this.Close(); main.ShowDialog(); } catch (Exception ex) { lblError.Content = ex.Message.ToString(); } }
private void btnOK_Click(object sender, EventArgs e) { CUser user = new CUser(txtEmail.Text, CUser.doSome.initialization); UserEmail = txtEmail.Text; string name = ""; if (user.Login(txtPwd.Text, ref name)) { UserName = name; Pass = true; this.Hide(); } else { MessageBox.Show("用户名或密码错误!请重新填写!!"); txtEmail.Focus(); } }
private void btnOK_Click(object sender, EventArgs e) { string name = ""; if (!txtVer.Text.Equals(string.Empty) && !txtVer.Text.Equals(validCode.CheckCode)) { MessageBox.Show("验证码输入错误!!"); txtVer.Focus(); } else { if (user.Login(txtPwd.Text, ref name)) { MessageBox.Show("验证成功!!"); this.Pass = true; this.Hide(); } } }
public static string Submit(string user_name,string user_password, bool ischecked) { string strErr = ""; TextBox txt_login_email; TextBox txt_login_password; Page page = (Page)HttpContext.Current.Handler; if (user_name.Trim() == "" || user_password.Trim() == "") { strErr = "<div class='alert alert-danger'><i class='fa fa-bell-o'></i> Username/Email or Password still empty! </div>"; } else { // string str_login_email = Microsoft.Security.Application.Encoder.JavaScriptEncode(user_name); // string str_login_password = Microsoft.Security.Application.Encoder.JavaScriptEncode(user_password); using (MD5 md5Hash = MD5.Create()) { CUser userObj = new CUser(); string hash = userObj.GetMd5Hash(md5Hash, user_password); List<CUser> lstUser = new List<CUser>(); lstUser = userObj.Login(user_name, hash); if (lstUser.Count() > 0) { Login objLogin = new Login(); objLogin.RegisterSession(lstUser); if (ischecked == true) { Login objLogin2 = new Login(); objLogin2.RegisterCookie(lstUser); } } else { strErr = "<div class='alert alert-danger'><i class='fa fa-bell-o'></i> Username/Email and Password is wrong! </div>"; } } } return strErr; }
public static string Submit(string user_name, string user_password, bool ischecked) { string strErr = ""; TextBox txt_login_email; TextBox txt_login_password; Page page = (Page)HttpContext.Current.Handler; if (user_name.Trim() == "" || user_password.Trim() == "") { strErr = "<div class='alert alert-danger'><i class='fa fa-bell-o'></i> Username/Email or Password still empty! </div>"; } else { // string str_login_email = Microsoft.Security.Application.Encoder.JavaScriptEncode(user_name); // string str_login_password = Microsoft.Security.Application.Encoder.JavaScriptEncode(user_password); using (MD5 md5Hash = MD5.Create()) { CUser userObj = new CUser(); string hash = userObj.GetMd5Hash(md5Hash, user_password); List <CUser> lstUser = new List <CUser>(); lstUser = userObj.Login(user_name, hash); if (lstUser.Count() > 0) { Login objLogin = new Login(); objLogin.RegisterSession(lstUser); if (ischecked == true) { Login objLogin2 = new Login(); objLogin2.RegisterCookie(lstUser); } } else { strErr = "<div class='alert alert-danger'><i class='fa fa-bell-o'></i> Username/Email and Password is wrong! </div>"; } } } return(strErr); }
public ActionResult Login(CUser user, string returnurl) { try { ViewBag.ReturnUrl = returnurl; if (user.Login()) { Session["user"] = user; return(Redirect(returnurl)); } else { ViewBag.Message = "Sorry, wrong credentials."; return(Redirect(returnurl)); } } catch (Exception ex) { ViewBag.Message = ex.Message; return(View()); } }
public ActionResult Login(CUser user, string returnurl) { try { returnurl = ViewBag.ReturnURL; if (user.Login()) { Session["user"] = user; return(RedirectToAction("index", "stock")); } else { ViewBag.Message = "Sorry, wrong credentials."; return(RedirectToAction("Login", "Login")); } } catch (Exception ex) { ViewBag.Message = ex.Message; return(View()); } }