diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index ce5c6f3d4..d423e4bc6 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -62,7 +62,7 @@ - + @@ -73,10 +73,6 @@ - - - - @@ -84,6 +80,7 @@ + diff --git a/BTCPayServer/Components/QRCode/QRCode.cs b/BTCPayServer/Components/QRCode/QRCode.cs index 13f7d50b0..29ed5ba7c 100644 --- a/BTCPayServer/Components/QRCode/QRCode.cs +++ b/BTCPayServer/Components/QRCode/QRCode.cs @@ -1,5 +1,4 @@ using System; -using System.Drawing; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ViewComponents; diff --git a/BTCPayServer/Extensions/EmailSenderExtensions.cs b/BTCPayServer/Extensions/EmailSenderExtensions.cs index f0e2367e0..cd5466a82 100644 --- a/BTCPayServer/Extensions/EmailSenderExtensions.cs +++ b/BTCPayServer/Extensions/EmailSenderExtensions.cs @@ -1,6 +1,7 @@ using System.Text.Encodings.Web; using BTCPayServer.Services.Mails; using MimeKit; +using QRCoder; namespace BTCPayServer.Services { @@ -42,7 +43,7 @@ namespace BTCPayServer.Services public static void SendInvitation(this IEmailSender emailSender, MailboxAddress address, string link) { emailSender.SendEmail(address, "Invitation", CreateEmailBody( - $"Please complete your account setup by clicking this link.")); + $"

Please complete your account setup by clicking this link.

You can also use the BTCPay Server app and scan this QR code when connecting:

{GetQrCodeImg(link)}")); } public static void SendNewUserInfo(this IEmailSender emailSender, MailboxAddress address, string newUserInfo, string link) @@ -56,5 +57,14 @@ namespace BTCPayServer.Services emailSender.SendEmail(address, userInfo, CreateEmailBody( $"{userInfo}. You can view the store users here: Store users")); } + + private static string GetQrCodeImg(string data) + { + using var qrGenerator = new QRCodeGenerator(); + using var qrCodeData = qrGenerator.CreateQrCode(data, QRCodeGenerator.ECCLevel.Q); + using var qrCode = new Base64QRCode(qrCodeData); + var base64 = qrCode.GetGraphic(20); + return $"{data}"; + } } }