summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorRaphael <mail@raphaelkabo.com>2024-02-25 21:27:13 +0000
committerGitHub <noreply@github.com>2024-02-25 21:27:13 +0000
commit7ff0bebd9fbdf1c982d7cc42a7057d36a3e2486a (patch)
tree05b1d8b1d63baed174883cc96807051e530969a2 /views
parentb17238eb2840553c69fc2dae168be557afbcee9c (diff)
parentcd0f291eb1a608589fcc2c1875fa7099ed8e2c51 (diff)
Merge pull request #133 from lowercasename/rk/restricted-event-creation
Optionally restrict event creation to specific email addresses
Diffstat (limited to 'views')
-rw-r--r--views/createEventMagicLink.handlebars30
-rw-r--r--views/emails/createEventMagicLink/createEventMagicLinkHtml.handlebars8
-rw-r--r--views/emails/createEventMagicLink/createEventMagicLinkText.handlebars11
-rwxr-xr-xviews/partials/eventForm.handlebars5
-rw-r--r--views/partials/eventGroupForm.handlebars5
-rw-r--r--views/partials/importeventform.handlebars5
6 files changed, 58 insertions, 6 deletions
diff --git a/views/createEventMagicLink.handlebars b/views/createEventMagicLink.handlebars
new file mode 100644
index 0000000..563af82
--- /dev/null
+++ b/views/createEventMagicLink.handlebars
@@ -0,0 +1,30 @@
+<article>
+
+ <h3 class="mb-4">Request a link to create a new event</h3>
+
+ <form
+ action="/magic-link/event/create"
+ method="post"
+ hx-post="/magic-link/event/create"
+ hx-target="article"
+ >
+ <p>
+ The administrator of this instance has limited event creation to a set of specific email addresses. If your email address is allowed to create events, you will be sent a magic link to create an event. If not, you won't receive anything.
+ </p>
+ <p>
+ If you run into any issues, please contact the instance administrator.
+ </p>
+ {{#if message}}
+ <div class="alert alert-{{message.type}}" role="alert">
+ {{message.text}}
+ </div>
+ {{/if}}
+ <div class="form-group">
+ <label for="email">Email address</label>
+ <input type="email" class="form-control" id="email" placeholder="Email address" required name="email">
+ </div>
+ <div class="form-group text-center">
+ <button type="submit" class="btn btn-primary w-50">Request magic link</button>
+ </div>
+ </form>
+</article>
diff --git a/views/emails/createEventMagicLink/createEventMagicLinkHtml.handlebars b/views/emails/createEventMagicLink/createEventMagicLinkHtml.handlebars
new file mode 100644
index 0000000..1379607
--- /dev/null
+++ b/views/emails/createEventMagicLink/createEventMagicLinkHtml.handlebars
@@ -0,0 +1,8 @@
+<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">Here's a magic link which will allow you to create an event on {{siteName}}.</p>
+<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">This link will expire in 24 hours and can be used multiple times before then. Don't share it publicly, because it will allow anyone to create an event on your behalf!</p>
+<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;"><a href="https://{{domain}}/new/{{token}}">https://{{domain}}/new/{{token}}</a></p>
+<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">Love,</p>
+<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">{{siteName}}</p>
+<hr/>
+<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;"><strong>Hold up - I have no idea what this email is about!</strong></p>
+<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">If you didn't try to create an event on {{siteName}}, someone may have accidentally typed your email instead of theirs. Don't worry - there isn't anything you need to do. Your email address will be deleted after the magic link expires.</p>
diff --git a/views/emails/createEventMagicLink/createEventMagicLinkText.handlebars b/views/emails/createEventMagicLink/createEventMagicLinkText.handlebars
new file mode 100644
index 0000000..e3b4f96
--- /dev/null
+++ b/views/emails/createEventMagicLink/createEventMagicLinkText.handlebars
@@ -0,0 +1,11 @@
+Here's a magic link which will allow you to create an event on {{siteName}}.
+
+This link will expire in 24 hours and can be used multiple times before then. Don't share it publicly, because it will allow anyone to create an event on your behalf!
+
+https://{{domain}}/new/{{token}}
+
+Love,
+
+{{siteName}}
+
+If you didn't try to create an event on {{siteName}}, someone may have accidentally typed your email instead of theirs. Don't worry - there isn't anything you need to do. Your email address will be deleted after the magic link expires.
diff --git a/views/partials/eventForm.handlebars b/views/partials/eventForm.handlebars
index c44a2ef..c2eebc3 100755
--- a/views/partials/eventForm.handlebars
+++ b/views/partials/eventForm.handlebars
@@ -1,3 +1,4 @@
+<input type="hidden" name="magicLinkToken" value="{{magicLinkToken}}" x-ref="magicLinkToken">
<div class="form-group">
<label for="eventName" >Event name</label>
<div class="form-group ">
@@ -65,7 +66,7 @@
<div class="form-group">
<label for="creatorEmail" >Your email</label>
<div class="form-group ">
- <input type="email" class="form-control" id="creatorEmail" name="creatorEmail" placeholder="Will not be shown anywhere (optional)." x-model="data.creatorEmail" >
+ <input type="email" class="form-control" id="creatorEmail" name="creatorEmail" placeholder="Will not be shown anywhere (optional)." x-model.fill="data.creatorEmail" {{#if creatorEmail}}value="{{creatorEmail}}" readonly{{/if}}>
<small class="form-text">If you provide your email, we will send your secret editing password here, and use it to notify you of updates to the event.</small>
</div>
</div>
@@ -159,7 +160,7 @@
<p><i class="fas fa-exclamation-triangle"></i> Please fix these errors:</p>
<ul>
<template x-for="error in errors">
- <li x-text="error.message"></li>
+ <li x-html="error.message"></li>
</template>
</ul>
</div>
diff --git a/views/partials/eventGroupForm.handlebars b/views/partials/eventGroupForm.handlebars
index e020f4a..258c321 100644
--- a/views/partials/eventGroupForm.handlebars
+++ b/views/partials/eventGroupForm.handlebars
@@ -1,3 +1,4 @@
+<input type="hidden" name="magicLinkToken" value="{{magicLinkToken}}" x-ref="magicLinkToken">
<div class="form-group">
<label for="eventGroupName">Name</label>
<input type="text" class="form-control" id="eventGroupName" name="eventGroupName" placeholder="Make it snappy." x-model="data.eventGroupName">
@@ -18,7 +19,7 @@
<div class="form-group">
<label for="creatorEmail">Your email</label>
<div class="form-group">
- <input type="email" class="form-control" id="eventGroupCreatorEmail" name="creatorEmail" placeholder="Will not be shown anywhere (optional)." x-model="data.creatorEmail">
+ <input type="email" class="form-control" id="eventGroupCreatorEmail" name="creatorEmail" placeholder="Will not be shown anywhere (optional)." x-model.fill="data.creatorEmail" {{#if creatorEmail}}value="{{creatorEmail}}" readonly{{/if}}>
<small class="form-text">If you provide your email, we will send your secret editing password here, and use it to notify you of updates to the event.</small>
</div>
</div>
@@ -40,7 +41,7 @@
<p><i class="fas fa-exclamation-triangle"></i> Please fix these errors:</p>
<ul>
<template x-for="error in errors">
- <li x-text="error.message"></li>
+ <li x-html="error.message"></li>
</template>
</ul>
</div>
diff --git a/views/partials/importeventform.handlebars b/views/partials/importeventform.handlebars
index d62b599..ac3c673 100644
--- a/views/partials/importeventform.handlebars
+++ b/views/partials/importeventform.handlebars
@@ -6,6 +6,7 @@
<img class="img-thumbnail mb-3 d-block mx-auto" src="/images/facebook-export.png" alt="Image showing the location of the export option on Facebook" />
<form id="icsImportForm" enctype="multipart/form-data" x-data="importEventForm()" @submit.prevent="submitForm">
+ <input type="hidden" name="magicLinkToken" value="{{magicLinkToken}}" x-ref="magicLinkToken">
<div class="form-group">
<div class="custom-file" id="icsImportContainer">
<input required name="icsImportControl" type="file" class="custom-file-input" id="icsImportControl" aria-describedby="fileHelp" accept="text/calendar" x-ref="icsImportControl"/>
@@ -17,7 +18,7 @@
<div class="form-group">
<label for="creatorEmail" class="form-label">Your email</label>
<div class="form-group">
- <input type="email" class="form-control" id="importCreatorEmail" name="creatorEmail" placeholder="Will not be shown anywhere (optional)." x-model="data.creatorEmail" >
+ <input type="email" class="form-control" id="importCreatorEmail" name="creatorEmail" placeholder="Will not be shown anywhere (optional)." x-model.fill="data.creatorEmail" {{#if creatorEmail}}value="{{creatorEmail}}" readonly{{/if}}>
<small class="form-text">If you provide your email, we will send your secret editing password here, and use it to notify you of updates to the event.</small>
</div>
</div>
@@ -31,7 +32,7 @@
<p><i class="fas fa-exclamation-triangle"></i> Please fix these errors:</p>
<ul>
<template x-for="error in errors">
- <li x-text="error.message"></li>
+ <li x-html="error.message"></li>
</template>
</ul>
</div>