Exemple #1
0
        public ActionResult GrapherLogOn(GrapherLogOn model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                Encrypt encrypt = new Encrypt();
                string  saltkey = "";
                saltkey = _grapherService.getPasswordSalt(model.GrapherEmail);
                model.GrapherPassword = encrypt.ComputeHash(model.GrapherPassword, saltkey);

                string          msg        = "";
                LogOnResultType resultType = _grapherService.CheckAuthenticate(model.GrapherEmail, model.GrapherPassword, out msg);

                switch (resultType)
                {
                case LogOnResultType.SUCCESS:       //Login success
                    if (!string.IsNullOrEmpty(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("GrapherRegister", "Grapher"));
                    }

                //case LogOnResultType.PASSWORDEXPIRED:   //Password expired.
                //    return RedirectToAction("PasswordExpired", "User");
                //case LogOnResultType.USEREXPIRED:       //User Expired.
                //    ModelState.AddModelError("", msg);
                //    break;
                case LogOnResultType.USERLOCKED:            //User Locked.
                    ModelState.AddModelError("", msg);
                    break;

                case LogOnResultType.FAILED:                //Login failed.
                    ModelState.AddModelError("", msg);
                    break;

                default: break;
                }
            }
            else
            {
                ModelState.AddModelError("", "[ VALIDATION FAILED ].");
            }

            return(View(model));
        }
Exemple #2
0
        public ActionResult GrapherLogOn()
        {
            var model = new GrapherLogOn();

            return(View(model));
        }