Ejemplo n.º 1
0
 public JsonResult Copy(string widgetId)
 {
     _cookie.SetValue(Const.CopyWidgetCookie, widgetId, true, true);
     return(Json(new AjaxResult {
         Status = AjaxStatus.Normal, Message = "复制成功,请到需要的页面区域粘贴!"
     }));
 }
Ejemplo n.º 2
0
 public JsonResult Copy(string widgetId)
 {
     _cookie.SetValue(Const.CopyWidgetCookie, widgetId, true, true);
     return(Json(new AjaxResult {
         Status = AjaxStatus.Normal, Message = _localize.Get("Copy success")
     }));
 }
Ejemplo n.º 3
0
 public IActionResult PostMessage(MessageEntity entity, string redirect)
 {
     if (ModelState.IsValid)
     {
         _cookie.SetValue("Message", "true", 1);
         entity.Status = (int)RecordStatus.InActive;
         _messageService.Add(entity);
     }
     return(Redirect(redirect));
 }
Ejemplo n.º 4
0
        public void SetPreview(string id)
        {
            var theme = GetAllThemes().FirstOrDefault(m => m.ID.Equals(id, StringComparison.OrdinalIgnoreCase));

            if (theme == null)
            {
                throw new Exception("Theme not found.");
            }

            _cookie.SetValue(PreViewCookieName, theme.ID, true, true);
        }
Ejemplo n.º 5
0
        public ActionResult LogOn(LogOnCommand command)
        {
            Check.Argument.IsNotNull(command, "command");

            Identifier id;

            if (string.IsNullOrWhiteSpace(command.UserName) || !Identifier.TryParse(command.UserName, out id))
            {
                string errorMessage = string.IsNullOrWhiteSpace(command.UserName) ? TextMessages.OpenIDUserNameCannotBeBlank : TextMessages.InvalidOpenIDUserName;

                ModelState.AddModelError(ModelStateUserNameKey, errorMessage);
            }
            else
            {
                cookie.SetValue(CookieRememberMe, command.RememberMe ?? false);
                cookie.SetValue(CookieReturnUrl, !string.IsNullOrWhiteSpace(command.ReturnUrl) ? command.ReturnUrl : Url.Home());

                try
                {
                    Realm realm = new Realm(new Uri(Url.ToAbsolute(Url.LogOn())));
                    IAuthenticationRequest request = openId.CreateRequest(id, realm);

                    ClaimsRequest fetch = new ClaimsRequest {
                        Email = DemandLevel.Request
                    };
                    request.AddExtension(fetch);

                    request.RedirectToProvider();
                }
                catch (ProtocolException e)
                {
                    ModelState.AddModelError(ModelStateUserNameKey, e.Message);
                }
            }

            return(View());
        }
Ejemplo n.º 6
0
 public void SetPreview(string id)
 {
     _cookie.SetValue(PreViewCookieName, id, true, true);
 }
        public void SaveCode(string code)
        {
            string protectedCode = dataProtector.Protect(code);

            _cookie.SetValue(CookieName, Base64StringEncode(protectedCode), true, true);
        }