- Added forgot option
- added modify user
- moved login and register
This commit is contained in:
2019-01-29 19:59:12 +01:00
parent 583c67c61a
commit 746e5fe14b
17 changed files with 229 additions and 63 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using LinqToDB;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
namespace SeniorAssistant.Controllers
@@ -9,8 +10,10 @@ namespace SeniorAssistant.Controllers
[Route("")]
[Route("Home")]
[Route("Index")]
public IActionResult Index()
public IActionResult Login()
{
if (IsLogged())
return View("Profile");
return View();
}
@@ -52,13 +55,36 @@ namespace SeniorAssistant.Controllers
{
return CheckAuthorized("Message", user);
}
[Route("Profile")]
public IActionResult Profile()
{
return CheckAuthorized("Profile");
}
[Route("Register")]
public IActionResult Register()
{
if (IsLogged())
return View("Profile");
return View();
}
private IActionResult CheckAuthorized(string view, object model = null)
[Route("Forgot")]
public IActionResult Forgot(string username = "")
{
if (IsLogged())
return View("Profile");
var forgot = Db.Forgot.Where(f => f.Username.Equals(username)).FirstOrDefault();
return View(forgot);
}
protected IActionResult CheckAuthorized(string view, object model = null)
{
if (!IsLogged())
{
view = "Login";
model = "/" + view;
view = "Index";
}
return View(view, model);
}