mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-11 01:04:33 +01:00
* This refactors the email sending so that all the logic related to users and emails are now contained in one location. * The Reset password screen has been updated from its ugly plain self to use the same layout as the login. * An admin can now create a new account without specifying a password. A link is generated that can be given to the intended user to configure the password. If emails are configured, it also sends an email * An admin can now create accounts that still require the user to verify their if the setting is enabled from the server settings. A link is generated that can be given to the intended user to configure the password. If emails are configured, it also sends an email. * The above features can be used in conjunction: An email will have to verify their email through a link. Once verified, the user is redirected to setting the password. * When an email has been verified OR a password has been set, users are now redirected to the login page with the email filled in and a success status message shown instead of a dedicated thank you page.
47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
|
|
using BTCPayServer.Controllers;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Routing;
|
|
|
|
namespace Microsoft.AspNetCore.Mvc
|
|
{
|
|
public static class UrlHelperExtensions
|
|
{
|
|
public static string EmailConfirmationLink(this LinkGenerator urlHelper, string userId, string code, string scheme, HostString host, string pathbase)
|
|
{
|
|
return urlHelper.GetUriByAction(nameof(AccountController.ConfirmEmail), "Account",
|
|
new { userId, code }, scheme, host, pathbase);
|
|
}
|
|
|
|
public static string ResetPasswordCallbackLink(this LinkGenerator urlHelper, string userId, string code, string scheme, HostString host, string pathbase)
|
|
{
|
|
return urlHelper.GetUriByAction(
|
|
action: nameof(AccountController.SetPassword),
|
|
controller: "Account",
|
|
values: new { userId, code },
|
|
scheme: scheme,
|
|
host:host,
|
|
pathBase: pathbase
|
|
);
|
|
}
|
|
|
|
public static string PaymentRequestLink(this LinkGenerator urlHelper, string paymentRequestId, string scheme, HostString host, string pathbase)
|
|
{
|
|
return urlHelper.GetUriByAction(
|
|
action: nameof(PaymentRequestController.ViewPaymentRequest),
|
|
controller: "PaymentRequest",
|
|
values: new { id = paymentRequestId },
|
|
scheme, host, pathbase);
|
|
}
|
|
|
|
public static string InvoiceLink(this LinkGenerator urlHelper, string invoiceId, string scheme, HostString host, string pathbase)
|
|
{
|
|
return urlHelper.GetUriByAction(
|
|
action: nameof(InvoiceController.Invoice),
|
|
controller: "Invoice",
|
|
values: new { invoiceId = invoiceId },
|
|
scheme, host, pathbase);
|
|
}
|
|
}
|
|
}
|