Compare commits

...

2 commits

Author SHA1 Message Date
sam
a9ccc12671
add favicon 2024-12-11 01:44:12 +01:00
sam
a29d1fdb78
feat: plain text emails 2024-12-11 01:44:00 +01:00
5 changed files with 46 additions and 27 deletions

View file

@ -22,6 +22,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0"/> <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0"/>
<PackageReference Include="MimeKit" Version="4.9.0"/>
<PackageReference Include="Minio" Version="6.0.3"/> <PackageReference Include="Minio" Version="6.0.3"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/> <PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="NodaTime" Version="3.2.0"/> <PackageReference Include="NodaTime" Version="3.2.0"/>

View file

@ -19,9 +19,21 @@ namespace Foxnouns.Backend.Mailables;
public class AccountCreationMailable(Config config, AccountCreationMailableView view) public class AccountCreationMailable(Config config, AccountCreationMailableView view)
: Mailable<AccountCreationMailableView> : Mailable<AccountCreationMailableView>
{ {
private string PlainText() =>
$"""
Please continue creating a new pronouns.cc account by using the following link:
{view.BaseUrl}/auth/callback/email/{view.Code}
Note that this link will expire in one hour.
If you didn't mean to create a new account, feel free to ignore this email.
""";
public override void Build() public override void Build()
{ {
To(view.To).From(config.EmailAuth.From!).View("~/Views/Mail/AccountCreation.cshtml", view); To(view.To)
.From(config.EmailAuth.From!)
.View("~/Views/Mail/AccountCreation.cshtml", view)
.Text(PlainText());
} }
} }

View file

@ -19,9 +19,21 @@ namespace Foxnouns.Backend.Mailables;
public class AddEmailMailable(Config config, AddEmailMailableView view) public class AddEmailMailable(Config config, AddEmailMailableView view)
: Mailable<AddEmailMailableView> : Mailable<AddEmailMailableView>
{ {
private string PlainText() =>
$"""
Hello @{view.Username}, please confirm adding this email address to your account by using the following link:
{view.BaseUrl}/auth/callback/email/{view.Code}
Note that this link will expire in one hour.
If you didn't mean to link this email address to @{view.Username}, feel free to ignore this email.
""";
public override void Build() public override void Build()
{ {
To(view.To).From(config.EmailAuth.From!).View("~/Views/Mail/AddEmail.cshtml", view); To(view.To)
.From(config.EmailAuth.From!)
.View("~/Views/Mail/AddEmail.cshtml", view)
.Text(PlainText());
} }
} }

View file

@ -124,6 +124,17 @@
"Microsoft.Extensions.Primitives": "9.0.0" "Microsoft.Extensions.Primitives": "9.0.0"
} }
}, },
"MimeKit": {
"type": "Direct",
"requested": "[4.9.0, )",
"resolved": "4.9.0",
"contentHash": "DZXXMZzmAABDxFhOSMb6SE8KKxcRd/sk1E6aJTUE5ys2FWOQhznYV2Gl3klaaSfqKn27hQ32haqquH1J8Z6kJw==",
"dependencies": {
"BouncyCastle.Cryptography": "2.5.0",
"System.Formats.Asn1": "8.0.1",
"System.Security.Cryptography.Pkcs": "8.0.1"
}
},
"Minio": { "Minio": {
"type": "Direct", "type": "Direct",
"requested": "[6.0.3, )", "requested": "[6.0.3, )",
@ -284,8 +295,8 @@
}, },
"BouncyCastle.Cryptography": { "BouncyCastle.Cryptography": {
"type": "Transitive", "type": "Transitive",
"resolved": "2.2.1", "resolved": "2.5.0",
"contentHash": "A6Zr52zVqJKt18ZBsTnX0qhG0kwIQftVAjLmszmkiR/trSp8H+xj1gUOzk7XHwaKgyREMSV1v9XaKrBUeIOdvQ==" "contentHash": "rc7vRCq/KD3GtIwSgRtjanGaBwTb9nLenFDZnEcauWlssuuEoxcbMfWA3QWWho6QDMSOSkWjs657McdHzEtEcw=="
}, },
"CommunityToolkit.HighPerformance": { "CommunityToolkit.HighPerformance": {
"type": "Transitive", "type": "Transitive",
@ -633,17 +644,6 @@
"resolved": "1.6.17", "resolved": "1.6.17",
"contentHash": "Le+kehlmrlQfuDFUt1zZ2dVwrhFQtKREdKBo+rexOwaCoYP0/qpgT9tLxCsZjsgR5Itk1UKPcbgO+FyaNid/bA==" "contentHash": "Le+kehlmrlQfuDFUt1zZ2dVwrhFQtKREdKBo+rexOwaCoYP0/qpgT9tLxCsZjsgR5Itk1UKPcbgO+FyaNid/bA=="
}, },
"MimeKit": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "39KDXuERDy5VmHIn7NnCWvIVp/Ar4qnxZWg9m06DfRqDbW1B6zFv9o3Tdoa4CCu71tE/0SRqRCN5Z+bbffw6uw==",
"dependencies": {
"BouncyCastle.Cryptography": "2.2.1",
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Security.Cryptography.Pkcs": "7.0.3",
"System.Text.Encoding.CodePages": "7.0.0"
}
},
"Mono.TextTemplating": { "Mono.TextTemplating": {
"type": "Transitive", "type": "Transitive",
"resolved": "3.0.0", "resolved": "3.0.0",
@ -808,8 +808,8 @@
}, },
"System.Formats.Asn1": { "System.Formats.Asn1": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.1",
"contentHash": "+nfpV0afLmvJW8+pLlHxRjz3oZJw4fkyU9MMEaMhCsHi/SN9bGF9q79ROubDiwTiCHezmK0uCWkPP7tGFP/4yg==" "contentHash": "XqKba7Mm/koKSjKMfW82olQdmfbI5yqeoLV/tidRp7fbh5rmHAQ5raDI/7SU0swTzv+jgqtUGkzmFxuUg0it1A=="
}, },
"System.IO.Hashing": { "System.IO.Hashing": {
"type": "Transitive", "type": "Transitive",
@ -850,16 +850,8 @@
}, },
"System.Security.Cryptography.Pkcs": { "System.Security.Cryptography.Pkcs": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.3", "resolved": "8.0.1",
"contentHash": "yhwEHH5Gzl/VoADrXtt5XC95OFoSjNSWLHNutE7GwdOgefZVRvEXRSooSpL8HHm3qmdd9epqzsWg28UJemt22w==", "contentHash": "CoCRHFym33aUSf/NtWSVSZa99dkd0Hm7OCZUxORBjRB16LNhIEOf8THPqzIYlvKM0nNDAPTRBa1FxEECrgaxxA=="
"dependencies": {
"System.Formats.Asn1": "7.0.0"
}
},
"System.Text.Encoding.CodePages": {
"type": "Transitive",
"resolved": "7.0.0",
"contentHash": "LSyCblMpvOe0N3E+8e0skHcrIhgV2huaNcjUUEa8hRtgEAm36aGkRoC8Jxlb6Ra6GSfF29ftduPNywin8XolzQ=="
}, },
"System.Threading.Channels": { "System.Threading.Channels": {
"type": "Transitive", "type": "Transitive",

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 47.5 47.5" style="enable-background:new 0 0 47.5 47.5;" xml:space="preserve" version="1.1" id="svg2"><metadata id="metadata8"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/></cc:Work></rdf:RDF></metadata><defs id="defs6"><clipPath id="clipPath16" clipPathUnits="userSpaceOnUse"><path id="path18" d="M 0,38 38,38 38,0 0,0 0,38 Z"/></clipPath></defs><g transform="matrix(1.25,0,0,-1.25,0,47.5)" id="g10"><g id="g12"><g clip-path="url(#clipPath16)" id="g14"><g transform="translate(35.3467,20.1069)" id="g20"><path id="path22" style="fill:#aa8ed6;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 0,0 -8.899,3.294 -3.323,10.891 c -0.128,0.42 -0.516,0.708 -0.956,0.708 -0.439,0 -0.828,-0.288 -0.956,-0.708 L -17.456,3.294 -26.356,0 c -0.393,-0.146 -0.653,-0.52 -0.653,-0.938 0,-0.418 0.26,-0.793 0.653,-0.937 l 8.896,-3.293 3.323,-11.223 c 0.126,-0.425 0.516,-0.716 0.959,-0.716 0.443,0 0.833,0.291 0.959,0.716 l 3.324,11.223 8.896,3.293 c 0.392,0.144 0.652,0.519 0.652,0.937 C 0.653,-0.52 0.393,-0.146 0,0"/></g><g transform="translate(15.3472,9.1064)" id="g24"><path id="path26" style="fill:#fcab40;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 0,0 -2.313,0.856 -0.9,3.3 c -0.119,0.436 -0.514,0.738 -0.965,0.738 -0.451,0 -0.846,-0.302 -0.965,-0.738 l -0.9,-3.3 L -8.356,0 c -0.393,-0.145 -0.653,-0.52 -0.653,-0.937 0,-0.418 0.26,-0.793 0.653,-0.938 l 2.301,-0.853 0.907,-3.622 c 0.111,-0.444 0.511,-0.756 0.97,-0.756 0.458,0 0.858,0.312 0.97,0.756 L -2.301,-2.728 0,-1.875 c 0.393,0.145 0.653,0.52 0.653,0.938 C 0.653,-0.52 0.393,-0.145 0,0"/></g><g transform="translate(11.0093,30.769)" id="g28"><path id="path30" style="fill:#5dadec;fill-opacity:1;fill-rule:nonzero;stroke:none" d="M 0,0 -2.365,0.875 -3.24,3.24 c -0.146,0.393 -0.52,0.653 -0.938,0.653 -0.419,0 -0.793,-0.26 -0.938,-0.653 L -5.992,0.875 -8.356,0 c -0.393,-0.146 -0.653,-0.52 -0.653,-0.938 0,-0.418 0.26,-0.792 0.653,-0.938 l 2.364,-0.875 0.876,-2.365 c 0.145,-0.393 0.519,-0.653 0.938,-0.653 0.418,0 0.792,0.26 0.938,0.653 L -2.365,-2.751 0,-1.876 c 0.393,0.146 0.653,0.52 0.653,0.938 C 0.653,-0.52 0.393,-0.146 0,0"/></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 2.4 KiB