2020-06-28 21:44:35 -05:00
|
|
|
|
2017-09-13 15:47:34 +09:00
|
|
|
using BTCPayServer.Controllers;
|
2020-03-13 11:47:22 +01:00
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Routing;
|
2017-09-13 15:47:34 +09:00
|
|
|
|
|
|
|
namespace Microsoft.AspNetCore.Mvc
|
|
|
|
{
|
|
|
|
public static class UrlHelperExtensions
|
|
|
|
{
|
2020-04-10 08:59:39 +02:00
|
|
|
public static string EmailConfirmationLink(this LinkGenerator urlHelper, string userId, string code, string scheme, HostString host, string pathbase)
|
2017-09-13 15:47:34 +09:00
|
|
|
{
|
2020-06-28 17:55:27 +09:00
|
|
|
return urlHelper.GetUriByAction(nameof(AccountController.ConfirmEmail), "Account",
|
|
|
|
new { userId, code }, scheme, host, pathbase);
|
2017-09-13 15:47:34 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
public static string ResetPasswordCallbackLink(this IUrlHelper urlHelper, string userId, string code, string scheme)
|
|
|
|
{
|
|
|
|
return urlHelper.Action(
|
|
|
|
action: nameof(AccountController.ResetPassword),
|
|
|
|
controller: "Account",
|
|
|
|
values: new { userId, code },
|
|
|
|
protocol: scheme);
|
|
|
|
}
|
2020-04-19 13:12:07 +02:00
|
|
|
|
2020-06-28 17:55:27 +09:00
|
|
|
public static string PaymentRequestLink(this LinkGenerator urlHelper, string paymentRequestId, string scheme, HostString host, string pathbase)
|
2020-04-19 13:12:07 +02:00
|
|
|
{
|
|
|
|
return urlHelper.GetUriByAction(
|
|
|
|
action: nameof(PaymentRequestController.ViewPaymentRequest),
|
|
|
|
controller: "PaymentRequest",
|
2020-06-28 17:55:27 +09:00
|
|
|
values: new { id = paymentRequestId },
|
2020-04-19 13:12:07 +02:00
|
|
|
scheme, host, pathbase);
|
|
|
|
}
|
2020-04-28 09:53:34 +02:00
|
|
|
|
2020-06-28 17:55:27 +09:00
|
|
|
public static string InvoiceLink(this LinkGenerator urlHelper, string invoiceId, string scheme, HostString host, string pathbase)
|
2020-04-28 09:53:34 +02:00
|
|
|
{
|
|
|
|
return urlHelper.GetUriByAction(
|
|
|
|
action: nameof(InvoiceController.Invoice),
|
|
|
|
controller: "Invoice",
|
2020-06-28 17:55:27 +09:00
|
|
|
values: new { invoiceId = invoiceId },
|
2020-04-28 09:53:34 +02:00
|
|
|
scheme, host, pathbase);
|
|
|
|
}
|
2017-09-13 15:47:34 +09:00
|
|
|
}
|
|
|
|
}
|