Beispiel #1
0
        public ActionResult Login(string email = null, string password = null)
        {
            if (Session["success-message"] != null)
            {
                ViewData.AddSafe("success-message", Session["success-message"]);
                Session.Remove("success-message");
            }
            if (Session["error-message"] != null)
            {
                ViewData.AddSafe("error-message", Session["error-message"]);
                Session.Remove("error-message");
            } //<--- this code sucks ... lol

            if (!String.IsNullOrEmpty(email) && !String.IsNullOrEmpty(password))
            {
                if (!email.ToLower().EndsWith("wakanow.com"))
                {
                    ViewData.AddSafe("error-message", "Email must be in the Wakanow Domain");
                    return(View());
                }
                if (Models.User.Validate(email, password))
                {
                    Site.Context().Session.AddSafe("json-edit-validated", true);
                    Models.User currentUser = (Models.User)Session["json-site-user"];
                    if (currentUser.IsRole("customer-feedback"))
                    {
                        return(this.Redirect("~/customerfeedback/admin"));
                    }
                    return(this.Redirect("~/edit"));
                }
                ViewData.AddSafe("error-message", "Invalid Email or Password");
            }
            return(View());
        }
Beispiel #2
0
 public ActionResult Validate(string t)
 {
     if (Models.User.ValidateLoginRequest(t))
     {
         Site.Context().Session.AddSafe("json-edit-validated", true);
         Models.User currentUser = (Models.User)Session["json-site-user"];
         if (currentUser.IsRole("customer-feedback"))
         {
             return(this.Redirect("~/customerfeedback/admin"));
         }
         return(this.Redirect("~/edit"));
     }
     return(this.Redirect("~/signin"));
 }