public LoginViewModel()
 {
     LostPassword = new LostPasswordViewModel();
     RequestLogin = new LostPasswordViewModel();
 }
        public ActionResult RequestLogin(LostPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                model.IncludeLayout = true;

                if (string.IsNullOrWhiteSpace(model.Email) && string.IsNullOrWhiteSpace(model.UniqueCode))
                {
                    model.ValidationSummary.AddMessage("Insira ao menos uma das informações solicitadas para continuar");
                }
                else
                {
                    return RedirectToRoute("AccountLogin", new { actionPerformed = "login-requisitado" });
                }

                return View("_RequestLogin", model);
            }

            // If we got this far, something failed, redisplay form
            return RedirectToRoute("AccountLogin");
        }
        public ActionResult LostPassword(LostPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                model.IncludeLayout = true;

                if (string.IsNullOrWhiteSpace(model.Email) && string.IsNullOrWhiteSpace(model.UniqueCode))
                {
                    model.ValidationSummary.AddMessage("Insira ao menos uma das informações solicitadas para continuar");
                }
                else
                {
                    ClinikeUser user = null;

                    if (!string.IsNullOrWhiteSpace(model.UniqueCode))
                    {
                        user = ClinikeUserEx.Find(i => i.UniqueId == model.UniqueCode);
                    }
                    else if (!string.IsNullOrWhiteSpace(model.Email))
                    {
                        user = ClinikeUserEx.Find(i => i.Email == model.Email);
                    }

                    if (user == null)
                    {
                        model.ValidationSummary.AddMessage("Email ou Código Unico invalido. Revise as informações, se o erro persisitir contate seu Médico.");
                    }
                    else
                    {
                        return RedirectToRoute("AccountLogin", new { actionPerformed = "senha-requisitada" });
                    }
                }

                return View("_LostPassword", model);
            }

            return RedirectToRoute("AccountLogin");
        }
 public ActionResult RequestLogin()
 {
     var model = new LostPasswordViewModel(true);
     return View("_RequestLogin", model);
 }
 public ActionResult LostPassword()
 {
     var model = new LostPasswordViewModel(true);
     return View("_LostPassword", model);
 }