Bugfix au login, et anonymes à l'index des blogs

main
Paul Schneider 10 years ago
parent 6e301e52d8
commit 591e6c5f46
3 changed files with 10 additions and 3 deletions

@ -62,9 +62,8 @@ namespace Yavsc.Controllers
} }
[HttpPost("~/login")] [HttpPost("~/login")]
public async Task<IActionResult> LocalLogin(LoginViewModel model) public async Task<IActionResult> SignIn(LoginViewModel model)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
// This doesn't count login failures towards account lockout // This doesn't count login failures towards account lockout

@ -36,6 +36,7 @@ namespace Yavsc.Controllers
} }
// GET: Blog // GET: Blog
[AllowAnonymous]
public IActionResult Index(string id) public IActionResult Index(string id)
{ {
if (!string.IsNullOrEmpty(id)) if (!string.IsNullOrEmpty(id))
@ -46,6 +47,7 @@ namespace Yavsc.Controllers
} }
[Route("/Title/{id?}")] [Route("/Title/{id?}")]
[AllowAnonymous]
public IActionResult Title(string id) public IActionResult Title(string id)
{ {
return View("Index", _context.Blogspot.Include( return View("Index", _context.Blogspot.Include(
@ -54,8 +56,13 @@ namespace Yavsc.Controllers
} }
[Route("/Blog/{id?}")] [Route("/Blog/{id?}")]
[AllowAnonymous]
public IActionResult UserPosts(string id) public IActionResult UserPosts(string id)
{ {
if (string.IsNullOrEmpty(id))
return View("Index",_context.Blogspot.Include(
b => b.Author
).Where(p => p.visible));
if (User.IsSignedIn()) if (User.IsSignedIn())
return View("Index", _context.Blogspot.Include( return View("Index", _context.Blogspot.Include(
b => b.Author b => b.Author
@ -65,6 +72,7 @@ namespace Yavsc.Controllers
).Where(x => x.Author.UserName == id && x.visible).ToList()); ).Where(x => x.Author.UserName == id && x.visible).ToList());
} }
// GET: Blog/Details/5 // GET: Blog/Details/5
[AllowAnonymous]
public IActionResult Details(long? id) public IActionResult Details(long? id)
{ {
if (id == null) if (id == null)

File diff suppressed because one or more lines are too long
Loading…