Beispiel #1
0
        public ActionResult LogOn()
        {
            LoginModel model = new LoginModel();
            model.Senha = "Walmart";
            model.Login = "******";

            return View(model);
        }
Beispiel #2
0
        public int StudentUpdate(Model.LoginModel st)
        {
            Student est = new Student()
            {
                Id   = st.Id,
                Name = st.Name
            };

            return(Update(est));
        }
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="loginDAL"></param>
        /// <returns></returns>
        public static bool RegisterDAL(Model.LoginModel model)
        {
            string    s  = string.Format("select * from UserInfo where UserName='******' and Pwd='{1}'", model.UserName, model.Pwd);
            DataTable dt = DBHelper.Select(s);

            if (dt.Rows.Count >= 1)
            {
                return(false);
            }
            else
            {
                string sql = string.Format("insert into UserInfo values('{0}','普通用户','{0}','{1}','','','{2}','','{3}','','','','使用')", model.UserName, model.Pwd, DateTime.Now, model.URL);
                return(DBHelper.Update(sql));
            }
        }
Beispiel #4
0
        public ActionResult LogOn(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                using (Web.UsuarioProxy.UsuarioServiceClient proxy = new Web.UsuarioProxy.UsuarioServiceClient())
                {
                    var result = proxy.Find(model.Login);

                    if ((result != null) && (result.Length > 0))
                    {
                        if (result.First().Senha.Equals(model.Senha))
                        {
                            FormsService.SignIn(model.Login, false);
                            if (!String.IsNullOrEmpty(returnUrl))
                            {
                                return Redirect(returnUrl);
                            }
                            else
                            {
                                return RedirectToAction("Index", "Home");
                            }
                        }
                        else
                        {
                            ModelState.AddModelError("", "Senha incorreta.");
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "Usuário não encontrado.");
                    }
                }
            }

            // volta para a view
            return View(model);
        }
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
            {
                return RedirectToLocal(returnUrl);
            }

            // If we got this far, something failed, redisplay form
            ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return View(model);
        }
Beispiel #6
0
 public async Task<string> GetAuthKey(LoginModel model)
 {
     var authkey = await _accountService.GenerateAuthKey(model.UserName, model.Password);
     return authkey;
 }
 /// <summary>
 /// 注册
 /// </summary>
 /// <param name="loginDAL"></param>
 /// <returns></returns>
 public static bool RegisterBLL(Model.LoginModel model)
 {
     return(LoginDAL.RegisterDAL(model));
 }