Fixes
- Added forgot option - added modify user - moved login and register
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user