public IBarelyView WhoAmI() { if (FSCAuth.IsAuthenticated()) { return(new WrapperView("Is this a test? You're " + CurrentUser.Username)); } else { return(new WrapperView("You are not special. You are not a beautiful or unique snowflake")); } }
public IBarelyView SetComments(bool enabled) { FSCAuth.RequiresLogin(); var c = Config.GetDB().GetCollection("config"); var config = c.FindOneAs <ConfigData>(); config.AllowComments = enabled; c.Save <ConfigData>(config); if (enabled) { return(new WrapperView("Comments enabled")); } else { return(new WrapperView("Comments disabled")); } }
public IBarelyView Login(LoginModel model) { if (Method != HttpMethod.Post) { return(new LoginView()); } else { if (FSCAuth.Login(model.Username, model.Password, false)) { Response.Redirect("/new"); } else { return(new WrapperView("Fail")); } return(null); } }
void BuildOutput() { __Write(@"<!DOCTYPE HTML> "); __Write(@" <html> <head> <title></title> </head> <body style=""max-width: 700px""> " ); foreach (var comment in Comments) { __Write(@" <div> </div>By " ); { object __v; __v = HttpUtility.HtmlEncode(comment.Name); __OutputVariable(__v); } __Write(@"</div> " ); { object __v; __v = "<pre>" + HttpUtility.HtmlEncode(comment.Text) + "</pre>"; __OutputVariable(__v); } __Write(@" <div>posted at " ); { object __v; __v = HttpUtility.HtmlEncode(comment.Posted.ToString()); __OutputVariable(__v); } __Write(@" " ); if (FSCAuth.IsAuthenticated()) { __Write(@" <div>IP: " ); { object __v; __v = comment.IPAddress; __OutputVariable(__v); } __Write(@"</div> <div>Agent: " ); { object __v; __v = HttpUtility.HtmlEncode(comment.UserAgent); __OutputVariable(__v); } __Write(@"</div> " ); } __Write(@" <div><a href=""" ); { object __v; __v = BlogHandler.GetUrl(comment.GetOwner()); __OutputVariable(__v); } __Write(@""">Go to Comment</a></div> </div> " ); } __Write(@" </body> </html> "); }
public IBarelyView Logout() { FSCAuth.Logout(); return(new WrapperView("you've been logged out")); }