Example #1
0
        public void SaveThumbnail(string body, Content content)
        {
#if DEBUG
            if (!DbUtil.DatabaseExists("CMSi_" + CurrentDatabase.Host))
            {
                return;
            }
#endif
            if (ContentTypeCode.IsTemplate(content.TypeID))
            {
                try
                {
                    var captureWebPageBytes = CaptureWebPageBytes(body, 100, 150);
                    var ii = CurrentImageDatabase.UpdateImageFromBits(content.ThumbID, captureWebPageBytes);
                    if (ii == null)
                    {
                        content.ThumbID = ImageData.Image.NewImageFromBits(captureWebPageBytes, CurrentImageDatabase).Id;
                    }
                }
                catch (Exception ex)
                {
                    var errorLog = ErrorLog.GetDefault(null);
                    errorLog.Log(new Error(ex));
                }
            }
        }
Example #2
0
        public ActionResult LogOn()
        {
            if (!DbUtil.DatabaseExists())
            {
                return(Redirect("/Errors/DatabaseNotFound.aspx?dbname=" + Util.Host));
            }

            if (DbUtil.Db.Roles.Any(rr => rr.RoleName == "disabled"))
            {
                return(Content("Site is disabled, contact {0} for help".Fmt(Util.SendErrorsTo()[0].Address)));
            }

            if (!User.Identity.IsAuthenticated)
            {
                string user = AccountModel.GetValidToken(Request.QueryString["otltoken"]);
                if (user.HasValue())
                {
                    FormsAuthentication.SetAuthCookie(user, false);
                    AccountModel.SetUserInfo(user, Session);
                    Util.FormsBasedAuthentication = true;
                    var returnUrl = Request.QueryString["returnUrl"];
                    if (returnUrl.HasValue())
                    {
                        return(Redirect(returnUrl));
                    }
                    return(Redirect("/"));
                }
            }
            return(View());
        }