예제 #1
0
        public ActionResult LoginMethod(LoginForm login)
        {
            if (ModelState.IsValid)
            {
                try {
                    var u = clientHttp.AuthenticationPost(login.Email, login.Password);

//                    Session["user"] = clientHttp.Get<User>(string.Format(@"User/{0}", login.Email));

//                    Gambiarra pra fazer funcionar, e seguir o projeto,
//                    não consegui fazer get do usuário de outra forma, e nem com a validação
                    var user = (User)clientHttp.Get <User>(string.Format(@"User/{0}", "862ccb69-7785-4ad6-ad40-bff07deafc63"));

                    Session["user"] = user;
                    if (user.IsEntity)
                    {
                        return(RedirectToAction("Index", "Entity"));
                    }
                    if (user.IsVoluntary)
                    {
                        return(RedirectToAction("Index", "Voluntary"));
                    }
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("Logout"));
                }
            }
            return(RedirectToAction("Logout"));
        }
예제 #2
0
        public ActionResult LoginMethod(LoginForm login)
        {
            if (ModelState.IsValid)
            {
                try {
                    var u = clientHttp.AuthenticationPost(login.Email, login.Password);

                    var user = (User)clientHttp.Get <User>(string.Format(@"User/{0}", "f680cc5c-4c7d-4861-aa63-88b5f3c19348"));
                    Session["user"] = user;
                    if (user.IsModerator)
                    {
                        return(RedirectToAction("Index", "Admin"));
                    }
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("Logout"));
                }
            }
            return(RedirectToAction("Logout"));
        }