add registrations endpoint and mobile view fix

This commit is contained in:
timurgordon 2022-10-26 12:46:13 +03:00
parent 511f5073aa
commit 03dae17348
6 changed files with 81 additions and 58 deletions

View File

@ -18,62 +18,65 @@
<div flex> <div flex>
<div class="bg-gray-800 text-white rounded text-sm w-fit font-medium p-1 mt-2 sm:mt-4">26 October 2022 @@6PM</div> <div class="bg-gray-800 text-white rounded text-sm w-fit font-medium p-1 mt-2 sm:mt-4">26 October 2022 @@6PM</div>
</div> </div>
<p class="mt-3 text- text-gray-500 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl"> <div id="content">
Join us at Mbweni Ruins, Jungle Paradise Resort to celebrate - with music, artists & food - our collective effort to pave the way towards a regenerative, inclusive and empowering digital future in Africa. Shuttles available from conference center. <p class="mt-3 text- text-gray-500 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">
<div class="mt-3 sm:mt-5 sm:max-w-lg sm:mx-auto sm:text-center lg:text-left lg:mx-0"> Join us at Mbweni Ruins, Jungle Paradise Resort to celebrate - with music, artists & food - our collective effort to pave the way towards a regenerative, inclusive and empowering digital future in Africa. Shuttles available from conference center.
<form hx-post="/register" class="mt-3 sm:flex flex-col"> </p>
<div> <div class="mt-3 sm:mt-5 sm:max-w-lg sm:mx-auto sm:text-center lg:text-left lg:mx-0">
<div class="md:flex"> <form hx-post="/register" hx-target="#content" class="mt-3 sm:flex flex-col">
<div class="flex-col md:mr-2"> <div>
<label for="name" class="block text-sm font-medium leading-5 text-gray-700">Name</label> <div class="md:flex">
<input id="name" name="name" aria-label="Name" class="appearance-none block w-full mt-1 px-2 py-2 sm:px-3 sm:py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Name Surname" /> <div class="flex-col md:mr-2">
<label for="name" class="block text-sm font-medium leading-5 text-gray-700">Name</label>
<input id="name" name="name" aria-label="Name" class="appearance-none block w-full mt-1 px-2 py-2 sm:px-3 sm:py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Name Surname" />
</div>
<div class="md:ml-2">
<label for="company_website" class="mt-1 lg:mt-0 block text-sm font-medium leading-5 text-gray-700">Organization Website</label>
<div class="mt-1 relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<span class="text-gray-500 sm:text-base sm:leading-5">
http://
</span>
</div>
<input id="company_website" name="org_website" class="form-input pl-16 sm:pl-14 appearance-none block w-full px-2 py-2 sm:px-3 sm:py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="www.example.com" />
</div>
</div> </div>
<div class="md:ml-2"> </div>
<label for="company_website" class="mt-1 lg:mt-0 block text-sm font-medium leading-5 text-gray-700">Organization Website</label> </div>
<div class="mt-1 relative rounded-md shadow-sm"> <div class="mt-3 sm:flex">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> <input aria-label="Email" name="email" class="appearance-none block w-full px-2 py-2 sm:px-3 sm:py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Enter your email" />
<span class="text-gray-500 sm:text-base sm:leading-5"> <button type="submit" class="mt-3 w-full px-6 py-2 sm:py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-gray-800 shadow-sm hover:bg-gray-700 focus:outline-none focus:border-gray-900 focus:shadow-outline-gray active:bg-gray-900 transition duration-150 ease-in-out sm:mt-0 sm:ml-3 sm:flex-shrink-0 sm:inline-flex sm:items-center sm:w-auto">
http:// Register
</span> </button>
</div>
<div class="relative mt-2 sm:mt-4 flex">
<div class="flex items-center h-5">
<input id="settings-option-0" name="plus_one" type="checkbox" class="form-radio h-4 w-4 text-indigo-600 transition duration-150 ease-in-out cursor-pointer" />
</div>
<label for="settings-option-0" class="ml-3 flex flex-col cursor-pointer">
<!-- On: "text-indigo-900", Off: "text-gray-900" -->
<span class="block text-sm leading-5 font-normal">
I want to register a plus one to join the event.
</span>
</label>
</div> </div>
<input id="company_website" name="org_website" class="form-input pl-16 sm:pl-14 appearance-none block w-full px-2 py-2 sm:px-3 sm:py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="www.example.com" /> <div class="relative mt-2 sm:mt-4 flex">
</div> <div class="flex items-center h-5">
</div> <input id="settings-option-1" name="receive_communication" type="checkbox" class="form-radio h-4 w-4 text-indigo-600 transition duration-150 ease-in-out cursor-pointer" checked />
</div> </div>
</div> <label for="settings-option-1" class="ml-3 flex flex-col cursor-pointer">
<div class="mt-3 sm:flex"> <!-- On: "text-indigo-900", Off: "text-gray-900" -->
<input aria-label="Email" name="email" class="appearance-none block w-full px-2 py-2 sm:px-3 sm:py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Enter your email" /> <span class="block text-sm leading-5 font-normal">
<button type="submit" class="mt-3 w-full px-6 py-2 sm:py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-gray-800 shadow-sm hover:bg-gray-700 focus:outline-none focus:border-gray-900 focus:shadow-outline-gray active:bg-gray-900 transition duration-150 ease-in-out sm:mt-0 sm:ml-3 sm:flex-shrink-0 sm:inline-flex sm:items-center sm:w-auto"> I want to receive communication on Ourworld.
Register </span>
</button> </label>
</div> </div>
<div class="relative mt-2 sm:mt-4 flex"> </form>
<div class="flex items-center h-5"> <p class="mt-1 sm:mt-3 text-sm leading-5 text-gray-500">
<input id="settings-option-0" name="plus_one" type="checkbox" class="form-radio h-4 w-4 text-indigo-600 transition duration-150 ease-in-out cursor-pointer" /> We won't share your data. Read our
</div> <a href="https://library.threefold.me/info/legal/#/legal__privacypolicy" target="_blank" class="font-medium text-gray-900 underline">Privacy Policy</a>.
<label for="settings-option-0" class="ml-3 flex flex-col cursor-pointer"> </p>
<!-- On: "text-indigo-900", Off: "text-gray-900" --> </div>
<span class="block text-sm leading-5 font-normal">
I want to register a plus one to join the event.
</span>
</label>
</div>
<div class="relative mt-2 sm:mt-4 flex">
<div class="flex items-center h-5">
<input id="settings-option-1" name="receive_communication" type="checkbox" class="form-radio h-4 w-4 text-indigo-600 transition duration-150 ease-in-out cursor-pointer" checked />
</div>
<label for="settings-option-1" class="ml-3 flex flex-col cursor-pointer">
<!-- On: "text-indigo-900", Off: "text-gray-900" -->
<span class="block text-sm leading-5 font-normal">
I want to receive communication on Ourworld.
</span>
</label>
</div>
</form>
<p class="mt-2 sm:mt-3 text-sm leading-5 text-gray-500">
We care about the protection of your data. Read our
<a href="https://library.threefold.me/info/legal/#/legal__privacypolicy" target="_blank" class="font-medium text-gray-900 underline">Privacy Policy</a>.
</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@
<input id="name" name="name" aria-label="Name" class="appearance-none block w-full mt-1 px-3 py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Name Surname" /> <input id="name" name="name" aria-label="Name" class="appearance-none block w-full mt-1 px-3 py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Name Surname" />
</div> </div>
<div class="md:ml-2"> <div class="md:ml-2">
<label for="company_website" class="block text-sm font-medium leading-5 text-gray-700">Organization Website</label> <label for="company_website" class="mt-1 lg:mt-0 block text-sm font-medium leading-5 text-gray-700">Organization Website</label>
<div class="mt-1 relative rounded-md shadow-sm"> <div class="mt-1 relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<span class="text-gray-500 sm:text-base sm:leading-5"> <span class="text-gray-500 sm:text-base sm:leading-5">

View File

@ -7,7 +7,7 @@
<input id="name" name="name" aria-label="Name" class="appearance-none block w-full mt-1 px-3 py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Name Surname" /> <input id="name" name="name" aria-label="Name" class="appearance-none block w-full mt-1 px-3 py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Name Surname" />
</div> </div>
<div class="md:ml-2"> <div class="md:ml-2">
<label for="company_website" class="block text-sm font-medium leading-5 text-gray-700">Organization Website</label> <label for="company_website" class="mt-1 lg:mt-0 block text-sm font-medium leading-5 text-gray-700">Organization Website</label>
<div class="mt-1 relative rounded-md shadow-sm"> <div class="mt-1 relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<span class="text-gray-500 sm:text-base sm:leading-5"> <span class="text-gray-500 sm:text-base sm:leading-5">

View File

@ -7,7 +7,7 @@
<input id="name" name="name" aria-label="Name" class="appearance-none block w-full mt-1 px-3 py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Name Surname" /> <input id="name" name="name" aria-label="Name" class="appearance-none block w-full mt-1 px-3 py-3 border border-gray-300 text-base leading-6 rounded-md placeholder-gray-500 shadow-sm focus:outline-none focus:placeholder-gray-400 focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:flex-1" placeholder="Name Surname" />
</div> </div>
<div class="md:ml-2"> <div class="md:ml-2">
<label for="company_website" class="block text-sm font-medium leading-5 text-gray-700">Organization Website</label> <label for="company_website" class="mt-1 lg:mt-0 block text-sm font-medium leading-5 text-gray-700">Organization Website</label>
<div class="mt-1 relative rounded-md shadow-sm"> <div class="mt-1 relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<span class="text-gray-500 sm:text-base sm:leading-5"> <span class="text-gray-500 sm:text-base sm:leading-5">

View File

@ -1,4 +1,7 @@
<p class="mt-3 text- text-gray-500 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">
Join us at Mbweni Ruins, Jungle Paradise Resort to celebrate - with music, artists & food - our collective effort to pave the way towards a regenerative, inclusive and empowering digital future in Africa. Shuttles available from conference center.
</p>
<div class="relative pt-6 pb-8 text-green-600 font-medium"> <div class="relative pt-6 pb-8 text-green-600 font-medium">
Successfully registered to event! Successfully registered to event!
</div> </div>

View File

@ -57,7 +57,7 @@ pub fn (mut app App) register(name string, email string, org_website string, plu
if files.len > 1000 { if files.len > 1000 {
return app.full() return app.full()
} }
if email.len < 5 && !email.contains('@') && !email.contains('.') { if email.len < 5 || !email.contains('@') || !email.contains('.') {
return app.emailreq() return app.emailreq()
} }
if email.len > 100 || name.len > 100 || org_website.len > 200 || email.contains('<script>') || name.contains('<script>') || org_website.contains('<script>'){ if email.len > 100 || name.len > 100 || org_website.len > 200 || email.contains('<script>') || name.contains('<script>') || org_website.contains('<script>'){
@ -80,3 +80,20 @@ pub fn (mut app App) register(name string, email string, org_website string, plu
} }
return $vweb.html() return $vweb.html()
} }
pub fn (mut app App) registrations() vweb.Result {
key := os.getenv('ACCESS_KEY')
password := app.get_header('password')
if password != key {
return app.html('not authorized')
}
path := 'registrations'
files := os.ls(path) or { [] }
mut resp := 'Total registrations: $files.len \n'
for file in files {
content := os.read_file('registrations/$file') or {'error'}
resp += content
}
return app.html(resp)
}