Exemplo n.º 1
0
        public ActionResult Login(OnlineRegModel m)
        {
            var ret = AccountModel.AuthenticateLogon(m.username, m.password, Session, Request);
            if (ret is string)
            {
                ModelState.AddModelError("authentication", ret.ToString());
                return FlowList(m, "Login");
            }
            Session["OnlineRegLogin"] = true;
            var user = ret as User;
            if (m.orgid == Util.CreateAccountCode)
                return Content("/Person/Index/" + Util.UserPeopleId);

            m.CreateList();
            m.UserPeopleId = user.PeopleId;

            if (m.ManagingSubscriptions())
            {
                TempData["ms"] = Util.UserPeopleId;
                return Content("/OnlineReg/ManageSubscriptions/{0}".Fmt(m.masterorgid));
            }
            if (m.ChoosingSlots())
            {
                TempData["ps"] = Util.UserPeopleId;
                return Content("/OnlineReg/ManageVolunteer/{0}".Fmt(m.orgid));
            }
            if (m.OnlinePledge())
            {
                TempData["mp"] = Util.UserPeopleId;
                return Content("/OnlineReg/ManagePledge/{0}".Fmt(m.orgid));
            }
            if (m.ManageGiving())
            {
                TempData["mg"] = Util.UserPeopleId;
                return Content("/OnlineReg/ManageGiving/{0}".Fmt(m.orgid));
            }

            if (m.UserSelectsOrganization())
                m.List[0].ValidateModelForFind(ModelState, m);
            m.List[0].LoggedIn = true;
            m.History.Add("login");
            return FlowList(m, "Login");
        }