2019-05-01 16:46:24 +08:00
|
|
|
|
using Bootstrap.Client.Models;
|
|
|
|
|
using Longbow.Configuration;
|
2019-06-30 23:18:33 +08:00
|
|
|
|
using Microsoft.AspNetCore;
|
2019-05-01 16:46:24 +08:00
|
|
|
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Bootstrap.Client.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public IActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View(new NavigatorBarModel(this));
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public IActionResult About()
|
|
|
|
|
{
|
|
|
|
|
return View(new NavigatorBarModel(this));
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
2019-06-30 23:18:33 +08:00
|
|
|
|
/// <param name="id"></param>
|
2019-05-01 16:46:24 +08:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
public IActionResult Error(int id)
|
|
|
|
|
{
|
2019-07-01 15:48:54 +08:00
|
|
|
|
var options = ConfigurationManager.Get<BootstrapAdminAuthenticationOptions>();
|
2019-06-30 23:18:33 +08:00
|
|
|
|
var uriBuilder = new UriBuilder(options.AuthHost) { Query = QueryString.Create(CookieAuthenticationDefaults.ReturnUrlParameter, $"{Request.Scheme}://{Request.Host}{Request.PathBase}").ToString() };
|
2019-05-01 16:46:24 +08:00
|
|
|
|
uriBuilder.Path = uriBuilder.Path == "/" ? Request.Path.Value : uriBuilder.Path + Request.Path.Value;
|
|
|
|
|
return Redirect(uriBuilder.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|