添加项目文件。
This commit is contained in:
54
TightWiki/Controllers/UtilityController.cs
Normal file
54
TightWiki/Controllers/UtilityController.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NTDLS.Helpers;
|
||||
using TightWiki.Models.ViewModels.Utility;
|
||||
|
||||
namespace TightWiki.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Route("[controller]")]
|
||||
public class UtilityController(SignInManager<IdentityUser> signInManager, UserManager<IdentityUser> userManager)
|
||||
: WikiControllerBase(signInManager, userManager)
|
||||
{
|
||||
[AllowAnonymous]
|
||||
[HttpGet("Notify")]
|
||||
public ActionResult Notify()
|
||||
{
|
||||
SessionState.RequireViewPermission();
|
||||
|
||||
var model = new NotifyViewModel()
|
||||
{
|
||||
SuccessMessage = GetQueryValue("SuccessMessage", string.Empty),
|
||||
ErrorMessage = GetQueryValue("ErrorMessage", string.Empty),
|
||||
RedirectURL = GetQueryValue("RedirectURL", string.Empty),
|
||||
RedirectTimeout = GetQueryValue("RedirectTimeout", 0)
|
||||
};
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("ConfirmAction")]
|
||||
public ActionResult ConfirmAction(ConfirmActionViewModel model)
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet("ConfirmAction")]
|
||||
public ActionResult ConfirmAction()
|
||||
{
|
||||
var model = new ConfirmActionViewModel
|
||||
{
|
||||
ControllerURL = GetQueryValue("controllerURL").EnsureNotNull(),
|
||||
YesRedirectURL = GetQueryValue("yesRedirectURL").EnsureNotNull(),
|
||||
NoRedirectURL = GetQueryValue("noRedirectURL").EnsureNotNull(),
|
||||
Message = GetQueryValue("message").EnsureNotNull(),
|
||||
Style = GetQueryValue("Style").EnsureNotNull()
|
||||
};
|
||||
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user