public ActionResult Login(string username, string password, bool? rememberMe, string returnUrl)
    {
      if (User.Identity.IsAuthenticated) return Return(returnUrl);

      // Basic parameter validation
      List<string> errors = new List<string>();

      if (string.IsNullOrEmpty(username))
      {
        errors.Add("You must specify a username.");
      }

      if (errors.Count == 0)
      {
        User user = UserRepository.GetUser(username);
        if (user != null && user.CheckPassword(password))
        {
          FormsAuthentication.SetAuthCookie(username, rememberMe ?? false);
          return Return(returnUrl);
        }
        errors.Add("The username or password provided is incorrect.");
      }

      // If we got this far, something failed, redisplay form
      ViewData["errors"] = errors;
      ViewData["username"] = username;
      
      var m = new PageModel();
      if (Workspace == null) m.Workspace = AppService.GetWorkspace();
      return View("AccountLogin", m);
    }
 public void UpdatePageModel(PageModel pageModel)
 {
   //get any global assets from asset manager either in no group or in a group used on the current page
   foreach (Asset asset in Assets.Where(a => a.Group == Asset.NoGroup)) pageModel.Assets.Add(asset);
   var groups = pageModel.Assets.Select(a => a.Group).Distinct();
   foreach (Asset asset in Assets.Where(a => groups.Contains(a.Group))) pageModel.Assets.Add(asset);
 }
 //[ActionOutputCache(60, true)]
 public ViewResult Home(string workspace)
 {
   var m = new PageModel();
   //use default collection
   if (Workspace == null) m.Workspace = AppService.GetWorkspace();
   if (Collection == null) m.Collection = AppService.GetCollection();
   return View("BlogHome", m);
 }
 public ActionResult Login(string returnUrl, string error)
 {
   if (User.Identity.IsAuthenticated) return Return(returnUrl);
   if (error != null) ViewData["errors"] = new List<string>() { error };
   var m = new PageModel();
   //use default workspace
   if (Workspace == null) m.Workspace = AppService.GetWorkspace();
   return View("AccountLogin", m);
 }
    public override void UpdatePageModel(PageModel pageModel, Include include)
    {
      //TODO: don't hardcode path to default theme
      string tailscript = File.ReadAllText(
        HostingEnvironment.MapPath("~/js/default/OpenIdModalWidgetTail.js"));
      pageModel.AddToTailScript(tailscript);

      base.UpdatePageModel(pageModel, include);
    }
 public override void UpdatePageModel(PageModel pageModel, Include include)
 {
   pageModel.AddToTailScript("$(function() {$('.canrate').rater({ postHref: $('.canrate form').attr('action') });});");
   base.UpdatePageModel(pageModel, include);
 }
    public IEnumerable<string> GetAssetSources(AssetType type, PageModel pageModel, UrlHelper helper)
    {
      //load items not in any group or delivered by CDN
      foreach (Asset asset in GetNonGroupedAssets(pageModel.Assets, type))
      {
        if (Settings.Default.UseCDN && GetCdnUrl(asset.Name) != null)
          yield return GetCdnUrl(asset.Name);
        else yield return helper.AssetPath(asset.AssetType, asset.Name);
      }

      var groups = pageModel.Assets.Select(a => a.Group).Distinct().ToArray();
      var grouped = GetGroupedAssets(pageModel.Assets, groups, type);
      if (AssetGroupMode == AssetGroupMode.Disabled)
      {
        foreach (string s in grouped.Select(a => helper.AssetPath(a.AssetType, a.Name)))
          yield return s;
      }
      else //load local via combination
      {
        if (grouped.Count > 0)
        {
          foreach (string group in groups)
          {
            //the following method will load and cache the combined script for later
            var version = GetGroupCombined(type, group, helper).Md5;
            //add versioning querystring for future updates overridding expires
            yield return helper.RouteUrl("AssetGroup" + type.ToString(), new { group = group, v = version });
          }
        }
      }
    }
 public void UpdatePageModel(PageModel pageModel)
 {
   foreach (Asset asset in Assets) pageModel.Assets.Add(asset);
 }
 public virtual void UpdatePageModel(PageModel pageModel, Include include)
 {
   foreach (Asset asset in Assets) pageModel.Assets.Add(asset);
   if (TailScript != null) pageModel.AddToTailScript(TailScript);
 }