add redirection via params
This commit is contained in:
parent
c4b2b216ea
commit
02235b96aa
|
@ -1,5 +1,6 @@
|
||||||
@page
|
@page
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@model CardModel
|
@model CardModel
|
||||||
|
|
||||||
@{
|
@{
|
||||||
|
@ -7,7 +8,7 @@
|
||||||
Response.Redirect("/Cards");
|
Response.Redirect("/Cards");
|
||||||
|
|
||||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
Response.Redirect("/");
|
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
@page
|
@page
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@model CardsModel
|
@model CardsModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Cards";
|
ViewData["Title"] = "Cards";
|
||||||
|
|
||||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
Response.Redirect("/");
|
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-sm btn-primary" href="?refresh=@card.CardId">Refresh QR</a>
|
<a class="btn btn-sm btn-primary" href="?refresh=@card.CardId">Refresh QR</a>
|
||||||
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=card&id=@card.CardId">Delete</a>
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=card&id=@card.CardId&redir=@Request.GetDisplayUrl().UrlEncode()">Delete</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
@page
|
@page
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@using bahnplan.web.database
|
@using bahnplan.web.database
|
||||||
@model DeleteModel
|
@model DeleteModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Home";
|
ViewData["Title"] = "Home";
|
||||||
|
|
||||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
Response.Redirect("/");
|
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Request.Query.ContainsKey("confirm") && Request.Query["confirm"] == "true") {
|
if (Request.Query.ContainsKey("confirm") && Request.Query["confirm"] == "true") {
|
||||||
Layout = null;
|
Layout = null;
|
||||||
Response.Redirect("/");
|
|
||||||
|
if (Request.Query.ContainsKey("redir")) {
|
||||||
|
Response.Redirect(Request.Query["redir"]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Response.Redirect("/");
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,11 +44,11 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "leg": {
|
case "leg": {
|
||||||
Response.Redirect($"/Delete?item={Request.Query["item"]}&id={Request.Query["id"]}&confirm=true");
|
Response.Redirect($"/Delete?item={Request.Query["item"]}&id={Request.Query["id"]}&confirm=true&redir={Request.Query["redir"]}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "ticket": {
|
case "ticket": {
|
||||||
Response.Redirect($"/Delete?item={Request.Query["item"]}&id={Request.Query["id"]}&confirm=true");
|
Response.Redirect($"/Delete?item={Request.Query["item"]}&id={Request.Query["id"]}&confirm=true&redir={Request.Query["redir"]}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "card": {
|
case "card": {
|
||||||
|
@ -56,6 +64,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
<a href="@Request.Headers["Referer"]" class="btn btn-sm btn-secondary">Cancel</a>
|
<a href="@Request.Query["redir"]" class="btn btn-sm btn-secondary">Cancel</a>
|
||||||
<a href="/Delete?item=@Request.Query["item"]&id=@Request.Query["id"]&confirm=true" class="btn btn-sm btn-danger">Confirm</a>
|
<a href="/Delete?item=@Request.Query["item"]&id=@Request.Query["id"]&confirm=true&redir=@Request.Query["redir"]" class="btn btn-sm btn-danger">Confirm</a>
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
@page
|
@page
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@using bahnplan.web.database
|
@using bahnplan.web.database
|
||||||
@model IndexModel
|
@model IndexModel
|
||||||
@{
|
@{
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
<a class="btn btn-sm btn-primary" href="/Trip?id=@trip.TripId">View</a>
|
<a class="btn btn-sm btn-primary" href="/Trip?id=@trip.TripId">View</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=trip&id=@trip.TripId">Delete Trip</a>
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=trip&id=@trip.TripId&redir=@Request.GetDisplayUrl().UrlEncode()">Delete Trip</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
@page
|
@page
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@using bahnplan.web.database
|
@using bahnplan.web.database
|
||||||
@model InspectionModel
|
@model InspectionModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Inspection";
|
ViewData["Title"] = "Inspection";
|
||||||
|
|
||||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
Response.Redirect("/");
|
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Login";
|
ViewData["Title"] = "Login";
|
||||||
if (HttpContext.Session.GetString("authorized") == "true") {
|
if (HttpContext.Session.GetString("authorized") == "true") {
|
||||||
Response.Redirect("/");
|
if (Request.Query.ContainsKey("redir")) {
|
||||||
|
Response.Redirect(Request.Query["redir"]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Response.Redirect("/");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Web;
|
||||||
using bahnplan.web.database;
|
using bahnplan.web.database;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
@ -45,5 +46,7 @@ namespace bahnplan.web.Pages {
|
||||||
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
|
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
|
||||||
return Convert.ToBase64String(plainTextBytes);
|
return Convert.ToBase64String(plainTextBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string UrlEncode(this string plainText) => HttpUtility.UrlEncode(plainText);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,11 +1,12 @@
|
||||||
@page
|
@page
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@model OEAPIModel
|
@model OEAPIModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "OEAPI";
|
ViewData["Title"] = "OEAPI";
|
||||||
|
|
||||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
Response.Redirect("/");
|
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
@page
|
@page
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@model TicketModel
|
@model TicketModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Ticket";
|
ViewData["Title"] = "Ticket";
|
||||||
|
|
||||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
Response.Redirect("/");
|
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
@page
|
@page
|
||||||
@using Microsoft.AspNetCore.Http
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@using bahnplan.web.database
|
@using bahnplan.web.database
|
||||||
@model TripModel
|
@model TripModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Trip";
|
ViewData["Title"] = "Trip";
|
||||||
|
|
||||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
Response.Redirect("/");
|
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Request.Query.ContainsKey("separator")) {
|
if (Request.Query.ContainsKey("separator")) {
|
||||||
Response.Redirect(Request.Headers["Referer"]);
|
Response.Redirect(Request.Query["redir"]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=leg&id=@leg.LegId">- Separator</a>
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=leg&id=@leg.LegId&redir=@Request.GetDisplayUrl().UrlEncode()">- Separator</a>
|
||||||
</td>
|
</td>
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -121,16 +122,16 @@
|
||||||
@{
|
@{
|
||||||
await using var db = new Database.DbConn();
|
await using var db = new Database.DbConn();
|
||||||
if (!db.Legs.Any(p => p.DepTime == leg.DepTime + "_placeholder")) {
|
if (!db.Legs.Any(p => p.DepTime == leg.DepTime + "_placeholder")) {
|
||||||
<a class="btn btn-sm btn-outline-secondary" href="?separator=true&legid=@leg.LegId&id=@leg.TripId">+ Separator</a>
|
<a class="btn btn-sm btn-outline-secondary" href="?separator=true&legid=@leg.LegId&id=@leg.TripId&redir=@Request.GetDisplayUrl().UrlEncode()">+ Separator</a>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
<a class="btn btn-sm btn-outline-secondary disabled" href="?separator=true&legid=@leg.LegId&id=@leg.TripId">+ Separator</a>
|
<a class="btn btn-sm btn-outline-secondary disabled">+ Separator</a>
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=leg&id=@leg.LegId">- Leg</a>
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=leg&id=@leg.LegId&redir=@Request.GetDisplayUrl().UrlEncode()">- Leg</a>
|
||||||
@if (leg.TicketId != 0) {
|
@if (leg.TicketId != 0) {
|
||||||
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=ticket&id=@leg.LegId">- Ticket</a>
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=ticket&id=@leg.LegId&redir=@Request.GetDisplayUrl().UrlEncode()">- Ticket</a>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
<a class="btn btn-sm btn-outline-danger disabled">- Ticket</a>
|
<a class="btn btn-sm btn-outline-danger disabled">- Ticket</a>
|
||||||
|
|
Reference in a new issue