示例#1
0
        public virtual async Task <IActionResult> TermsOfUse(AcceptTermsViewModel model)
        {
            if (!AccountService.IsSignedIn(User) || string.IsNullOrWhiteSpace(CurrentSite.RegistrationAgreement))
            {
                return(this.RedirectToSiteRoot(CurrentSite));
            }

            if (!ModelState.IsValid)
            {
                ViewData["Title"]      = StringLocalizer["Registration Agreement Required"];
                model.TermsUpdatedDate = await TimeZoneHelper.ConvertToLocalTime(CurrentSite.TermsUpdatedUtc);

                model.AgreementRequired     = true;
                model.RegistrationAgreement = CurrentSite.RegistrationAgreement;
                model.RegistrationPreamble  = CurrentSite.RegistrationPreamble;

                return(View(model));
            }

            var result = await AccountService.AcceptRegistrationAgreement(User);

            //return Redirect("/");
            if (result)
            {
                return(this.RedirectToSiteRoot(CurrentSite));
            }

            return(View(model));
        }
        public async Task <IActionResult> AcceptTermsPost(AcceptTermsViewModel model)
        {
            if (!ModelState.IsValid || model.TermsAccepted == false)
            {
                return(View("AcceptTerms", model));
            }

            await _manageApi.LogAcceptTerms();

            return(new RedirectResult("/"));
        }
        public virtual ActionResult AcceptTerms()
        {
            LogI("AcceptTerms, userId=" + AccessManager.UserId);

            var model = new AcceptTermsViewModel(DbFactory, LogService, Time);

            if (AccessManager.UserId.HasValue)
            {
                model.Accept(AccessManager.UserId.Value, Request);
            }

            return(JsonGet(true));
        }
示例#4
0
        public virtual async Task <IActionResult> TermsOfUse()
        {
            if (!AccountService.IsSignedIn(User) || string.IsNullOrWhiteSpace(CurrentSite.RegistrationAgreement))
            {
                return(this.RedirectToSiteRoot(CurrentSite));
            }

            ViewData["Title"] = StringLocalizer["Registration Agreement Required"];

            var model = new AcceptTermsViewModel
            {
                TermsUpdatedDate      = await TimeZoneHelper.ConvertToLocalTime(CurrentSite.TermsUpdatedUtc),
                AgreementRequired     = true,
                RegistrationAgreement = CurrentSite.RegistrationAgreement,
                RegistrationPreamble  = CurrentSite.RegistrationPreamble
            };

            return(View(model));
        }
        public async Task <IActionResult> TermsOfUse()
        {
            if (!accountService.IsSignedIn(User) || string.IsNullOrWhiteSpace(Site.RegistrationAgreement))
            {
                return(this.RedirectToSiteRoot(Site));
            }

            ViewData["Title"] = sr["Registration Agreement Required"];

            var model = new AcceptTermsViewModel();

            model.TermsUpdatedDate = await timeZoneHelper.ConvertToLocalTime(Site.TermsUpdatedUtc);

            model.AgreementRequired     = true;
            model.RegistrationAgreement = Site.RegistrationAgreement;
            model.RegistrationPreamble  = Site.RegistrationPreamble;

            return(View(model));
        }