update design for authorize page

This commit is contained in:
reya 2024-01-22 09:05:27 +07:00
parent eb53b5250f
commit 13157d25d2

View File

@ -1,131 +1,108 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta name="robots" content="noindex">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<title>Authorize Request - Nostr</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://rsms.me/" />
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.tailwindcss.com?plugins=forms"></script>
<script>
function sendPostRequest(permissions) {
const url = '/requests/{{record.id}}';
const password = document.getElementById('password').value;
let callbackUrl;
{{#if callbackUrl}}
callbackUrl = '{{callbackUrl}}';
{{/if}}
const data = {
permissions,
password,
};
fetch(url, {
method: 'POST', // or 'PUT'
headers: {
'Content-Type': 'application/json',
tailwind.config = {
theme: {
extend: {
colors: {
neutral: {
750: '#313131'
}
},
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((data) => {
console.log('Success:', data);
if (data.error) {
document.getElementById('error').innerText = data.error;
document.getElementById('error').classList.remove('hidden');
return;
}
// hide main content and show close message
document.getElementById('main').classList.add('hidden');
document.getElementById('closeit').classList.remove('hidden');
// redirect to callback url
if (callbackUrl) {
const url = new URL(callbackUrl);
url.searchParams.append('pubkey', data.pubkey);
window.location.href = url.toString();
}
})
.catch((error) => {
console.error('Error:', error);
});
}
boxShadow: {
input: `
0px 1px 0px -1px var(--tw-shadow-color),
0px 1px 1px -1px var(--tw-shadow-color),
0px 1px 2px -1px var(--tw-shadow-color),
0px 2px 4px -2px var(--tw-shadow-color),
0px 3px 6px -3px var(--tw-shadow-color)
`,
highlight: `
inset 0px 0px 0px 1px var(--tw-shadow-color),
inset 0px 1px 0px var(--tw-shadow-color)
`,
},
}
}
}
</script>
<style>
html {
font-family: Inter;
:root {
font-family: "Inter", sans-serif;
}
@supports (font-variation-settings: normal) {
:root {
font-family: "Inter var", sans-serif;
}
}
font-size: 1rem;
}
body {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
label > span {
font-weight: 600;
}
.border {
background-clip: padding-box;
}
</style>
</head>
<body class="flex flex-col items-center justify-center min-h-screen min-w-screen px-10">
<div class="flex justify-center mb-6">
<h1 class="text-4xl font-black text-center text-primary w-full">
<svg id="_8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 927.56 361.95" class="w-full px-20"><defs><style>.cls-1{fill:none;}.cls-2{fill:#662482;}</style></defs><path class="cls-1" d="m72.63,0h782.3c40.09,0,72.63,32.54,72.63,72.63v216.69c0,40.09-32.54,72.63-72.63,72.63H72.63c-40.09,0-72.63-32.54-72.63-72.63V72.63C0,32.54,32.54,0,72.63,0Z"/><path class="cls-2" d="m857.69,133.61c-16.21.9-29.75,5.48-39.96,13.54-3.97,3.13-9.76.57-9.76-4.49v-.88c0-3.27-2.65-5.92-5.92-5.92h-33.11c-3.27,0-5.92,2.65-5.92,5.92v150.46c0,3.27,2.65,5.92,5.92,5.92h35.22c3.27,0,5.92-2.65,5.92-5.92v-70.7c0-31.07,17.2-45.25,43.14-45.25,1.51,0,2.91.05,4.32.13,3.39.2,6.24-2.51,6.24-5.91v-30.98c0-3.34-2.76-6.11-6.09-5.92Z"/><path class="cls-2" d="m728.78,263.61c-1.24-3.25-4.94-4.53-8.13-3.14-4.09,1.79-8.71,2.72-13.34,2.72-12.67,0-20.21-7.54-20.21-21.42v-96.41c0-3.24,2.62-5.86,5.86-5.86h28.7c3.24,0,5.86-2.62,5.86-5.86v-24.48c0-3.24-2.62-5.86-5.86-5.86h-28.7c-3.24,0-5.86-2.62-5.86-5.86v-27.8c0-3.24-2.62-5.86-5.86-5.86h-35.34c-3.24,0-5.86,2.62-5.86,5.86v27.8c0,3.24-2.62,5.86-5.86,5.86h-13.31c-3.24,0-5.86,2.62-5.86,5.86v24.48c0,3.24,2.62,5.86,5.86,5.86h13.31c3.24,0,5.86,2.62,5.86,5.86v97.01c0,38.62,22.33,58.23,60.64,58.23,12.38,0,24.54-2.42,33.84-7.47,2.62-1.42,3.8-4.54,2.74-7.32l-8.48-22.21Z"/><path class="cls-2" d="m504.8,184.13c0-8.45,9.05-15.09,30.17-15.09,13.14,0,27.23,2.39,41.43,9.27,2.95,1.43,6.49.32,7.88-2.65l10.73-22.9c1.4-2.98.11-6.5-2.86-7.91-15.41-7.32-37.26-11.4-57.19-11.4-47.37,0-75.12,21.72-75.12,52.49,0,64.87,98.05,37.71,98.05,64.26,0,9.05-8.14,14.79-29.87,14.79-17.58,0-36.81-4.94-51.05-12.54-2.99-1.6-6.68-.35-8.1,2.73l-10.7,23.04c-1.33,2.86-.22,6.24,2.55,7.74,15.73,8.5,40.73,14.63,65.48,14.63,48.57,0,76.63-21.42,76.63-51.59,0-63.96-98.05-37.11-98.05-64.86Z"/><path class="cls-2" d="m351.26,133.45c-51.59,0-89.3,34.69-89.3,83.57s37.71,83.57,89.3,83.57,89-34.69,89-83.57-37.41-83.57-89-83.57Zm42.94,109.73c-6.48,24.4-31.8,38.86-56.55,32.29-24.75-6.57-39.57-31.68-33.09-56.08,6.48-24.4,39.62-68.32,64.37-61.74,24.75,6.57,31.75,61.14,25.27,85.54Z"/><path class="cls-2" d="m162.43,133.45c-17.1,0-32.38,4.55-44.29,13.07-3.95,2.83-9.41.12-9.41-4.74,0-3.27-2.65-5.92-5.92-5.92h-33.11c-3.27,0-5.92,2.65-5.92,5.92v150.46c0,3.27,2.65,5.92,5.92,5.92h35.22c3.23,0,5.84-2.6,5.9-5.82v-8.76c0-65.62-34.67-114.78-.38-121.3,31.37-5.98,66.98-3.09,67.4,21.06.04,2.09.32,8.34,8.99,11.75,5.18,2.04,13.16,2.75,23.65,2.48,0,0,9.51-.76,9.51,8.94,0,12.06-21.29,11.21-21.29,11.21-7.05.33-23.65-1.61-33.11,1.23-5.01,1.51-9.36,4.35-12.01,9.55-4.41,8.65-6.51,27.67-6.84,47.54v16.2c0,3.27,2.65,5.92,5.92,5.92h71.12c3.27,0,5.92-2.65,5.92-5.92v-87c0-49.47-28.96-71.8-67.28-71.8Z"/><path class="cls-2" d="m166.12,187.59c0-7-5.67-12.67-12.67-12.67s-12.67,5.68-12.67,12.67,5.67,12.68,12.67,12.68,12.67-5.68,12.67-12.68Z"/><path class="cls-2" d="m229.71,205.25v87c0,3.27-2.65,5.92-5.92,5.92h-71.12c-3.27,0-5.92-2.65-5.92-5.92v-16.2c.33-19.87,2.43-38.89,6.84-47.54,2.65-5.2,7-8.04,12.01-9.55,9.46-2.84,26.06-.9,33.11-1.23,0,0,21.29.85,21.29-11.21,0-9.7-9.51-8.94-9.51-8.94-10.49.27-18.47-.44-23.65-2.48-8.67-3.41-8.95-9.66-8.99-11.75-.42-24.15-36.03-27.04-67.4-21.06-34.29,6.53.38,55.68.38,121.3v8.76c-.06,3.22-2.67,5.82-5.9,5.82h-35.22c-3.27,0-5.92-2.65-5.92-5.92v-150.46c0-3.27,2.65-5.92,5.92-5.92h33.11c3.27,0,5.92,2.65,5.92,5.92,0,4.86,5.46,7.57,9.41,4.74,11.91-8.53,27.19-13.07,44.29-13.07,38.31,0,67.28,22.33,67.28,71.8Zm-63.59-17.66c0-7-5.67-12.67-12.67-12.67s-12.67,5.68-12.67,12.67,5.67,12.68,12.67,12.68,12.67-5.68,12.67-12.68Z"/></svg>
</head>
<body
class="flex flex-col justify-center items-center min-h-screen bg-gray-100 dark:bg-neutral-800 text-neutrla-950 dark:text-neutral-50">
<div class="max-w-md mx-auto w-full px-2 md:px-4 lg:px-8">
<div id="main">
<h1
class="text-neutral-950 dark:text-neutral-50 text-lg font-semibold w-full">
Do you want to allow this client to use account
<br />
<span class="text-blue-500">{{record.keyName}}</span>?
</h1>
</div>
<div id="main">
<h1 class="text-center text-2xl font-semibold">Do you want to allow this client to use account
<br/>
<span class="font-black">{{record.keyName}}</span>?</h1>
<div id="error" class="flex flex-col gap-4 bg-red-200 rounded-lg p-4 w-full hidden">
<div id="error"
class="flex flex-col gap-4 bg-red-200 rounded-lg p-4 w-full hidden">
</div>
{{#unless authenticated}}
<div class="flex flex-col gap-4 mt-8">
<div class="flex flex-col gap-2 bg-neutral-200 rounded-lg p-4 w-full">
<span>Enter your password to authenticate this request</span>
<input type="password" id="password" name="password" class="border border-gray-300 rounded-lg px-4 py-2" placeholder="Password" />
</div>
<div class="flex flex-col gap-4 mt-10">
<label class="flex flex-col gap-2">
<span
class="text-sm font-medium text-neutral-800 dark:text-neutral-200">
Enter your password to authenticate this request
</span>
<div
class="relative before:pointer-events-none focus-within:before:opacity-100 before:opacity-0 before:absolute before:-inset-1 before:rounded-[11px] before:border before:border-blue-500 before:ring-2 before:ring-blue-500/20 before:transition after:pointer-events-none after:absolute after:inset-px after:rounded-[7px] after:shadow-highlight dark:after:shadow-white/5 dark:focus-within:after:shadow-blue-500/20 after:transition">
<input
type="password"
name="password"
required
class="w-full relative text-sm text-neutral-800 dark:text-neutral-200 bg-white dark:bg-neutral-750 placeholder:text-neutral-400 dark:placeholder:text-neutral-500 px-3.5 py-2 rounded-lg border border-black/5 shadow-input shadow-black/5 dark:shadow-black/10 !outline-none" />
</div>
</label>
</div>
{{/unless}}
<div class="flex flex-row items-center justify-center gap-8 mt-8">
<button onclick="sendPostRequest()" class="py-3 bg-black hover:bg-neutral-700 transition-all duration-300 text-lg rounded-lg px-10 justify-center items-center gap-2 inline-flex text-white font-semibold">Yes</button>
<button onclick="window.close()" class="text-lg px-10 bg-neutral-200 hover:!bg-neutral-300 transition-all duration-200 rounded-lg py-3">No</button>
<div class="flex flex-col items-center justify-center gap-2 mt-5">
<button onclick="sendPostRequest()"
class="px-6 py-2 w-full bg-neutral-900 dark:bg-neutral-100 hover:bg-neutral-800 dark:hover:bg-neutral-200 dark:text-neutral-950 font-bold rounded-lg justify-center items-center gap-2 inline-flex text-white font-semibold">
Yes
</button>
<button onclick="window.close()"
class="px-6 py-2 w-full bg-neutral-200 dark:bg-neutral-700 hover:bg-neutral-300 dark:hover:bg-neutral-600 dark:text-neutral-50 font-bold rounded-lg justify-center items-center gap-2 inline-flex text-neutral-950 font-semibold">
No
</button>
</div>
</div>
</div>
<div class="hidden" id="closeit">
<div class="hidden" id="closeit">
<div class="flex justify-center mb-6">
<p class="text-center text-gray-600">
You can close this window now.
</p>
<p class="text-center text-gray-600">
You can close this window now.
</p>
</div>
</div>
</div>
<!-- List all cookies -->
<script>
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
console.log(cookies[i]);
}
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
console.log(cookies[i]);
}
</script>
<style lang="postcss">
.button {
@apply px-3 py-1.5 bg-white rounded-lg justify-center items-center gap-2 inline-flex;
@apply text-black text-base font-semibold;
}
</style>
</body>
</body>
</html>