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,10 +18,12 @@
<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>
<div id="content">
<p class="mt-3 text- text-gray-500 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl"> <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. 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="mt-3 sm:mt-5 sm:max-w-lg sm:mx-auto sm:text-center lg:text-left lg:mx-0"> <div class="mt-3 sm:mt-5 sm:max-w-lg sm:mx-auto sm:text-center lg:text-left lg:mx-0">
<form hx-post="/register" class="mt-3 sm:flex flex-col"> <form hx-post="/register" hx-target="#content" class="mt-3 sm:flex flex-col">
<div> <div>
<div class="md:flex"> <div class="md:flex">
<div class="flex-col md:mr-2"> <div class="flex-col md:mr-2">
@ -70,13 +72,14 @@
</label> </label>
</div> </div>
</form> </form>
<p class="mt-2 sm:mt-3 text-sm leading-5 text-gray-500"> <p class="mt-1 sm:mt-3 text-sm leading-5 text-gray-500">
We care about the protection of your data. Read our We won't share 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>. <a href="https://library.threefold.me/info/legal/#/legal__privacypolicy" target="_blank" class="font-medium text-gray-900 underline">Privacy Policy</a>.
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</div>
</main> </main>
</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)
}