Skip to content

Commit

Permalink
feat: new configuration options (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Teddy-Schmitz authored Nov 8, 2023
1 parent 39d6fe7 commit 3e07d84
Show file tree
Hide file tree
Showing 43 changed files with 497 additions and 888 deletions.
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"printWidth": 120
}
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [

],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
}
7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.singleQuote": false
}
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const buildApp = async (serverOptions) => {
const app = Fastify(serverOptions);

try {
// Register the defaul authc plugins and routes
// Register the default authc plugins and routes
await app
.register(sqlite3)
.register(serverkey)
Expand Down
191 changes: 43 additions & 148 deletions client/admin/dashboardPage.html

Large diffs are not rendered by default.

53 changes: 11 additions & 42 deletions client/admin/loginAdminPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,9 @@
</head>
<body id="app">
<!-- Alert -->
<div
v-cloak
v-if="showError"
role="alert"
class="p-4 border-red-500 rounded border-s-4 bg-red-50"
>
<div v-cloak v-if="showError" role="alert" class="p-4 border-red-500 rounded border-s-4 bg-red-50">
<div class="flex items-center gap-2 text-red-800">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class="w-5 h-5"
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-5 h-5">
<path
fill-rule="evenodd"
d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z"
Expand All @@ -47,11 +37,7 @@
<!-- Form -->
<div class="max-w-screen-xl px-4 py-16 mx-auto sm:px-6 lg:px-8">
<div class="max-w-lg mx-auto">
<form
@submit.prevent
action=""
class="p-4 mt-6 mb-0 rounded-lg shadow-lg sm:p-6 lg:p-8"
>
<form @submit.prevent action="" class="p-4 mt-6 mb-0 rounded-lg shadow-lg sm:p-6 lg:p-8">
<div class="flex flex-row text-xl font-semibold">
<span class="mr-1 -rotate-90">
<svg
Expand All @@ -72,9 +58,7 @@
Admin Dashboard Login
</div>

<p class="my-4 text-lg mx-4text-left">
Welcome, sign in with your admin credentials.
</p>
<p class="my-4 text-lg mx-4text-left">Welcome, sign in with your admin credentials.</p>

<div class="my-4">
<label for="email" class="sr-only">Email</label>
Expand All @@ -88,9 +72,7 @@
placeholder="Enter email"
/>

<span
class="absolute inset-y-0 grid px-4 end-0 place-content-center"
>
<span class="absolute inset-y-0 grid px-4 end-0 place-content-center">
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-4 h-4 text-gray-400"
Expand Down Expand Up @@ -120,9 +102,7 @@
placeholder="Enter password"
/>

<span
class="absolute inset-y-0 grid px-4 end-0 place-content-center"
>
<span class="absolute inset-y-0 grid px-4 end-0 place-content-center">
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-4 h-4 text-gray-400"
Expand Down Expand Up @@ -184,19 +164,13 @@
<div class="m-4 text-xs text-gray-400">
Powered by
<span class="underline">
<a href="https://github.com/authcompanion/authcompanion2"
>AuthCompanion</a
>
<a href="https://github.com/authcompanion/authcompanion2">AuthCompanion</a>
</span>
</div>
</div>
<!-- scripts -->
<script type="module">
import {
createApp,
ref,
computed,
} from "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.esm-browser.prod.js";
import { createApp, ref, computed } from "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.esm-browser.prod.js";

createApp({
setup() {
Expand Down Expand Up @@ -225,15 +199,11 @@
"content-type": "application/json",
},
});
const appOrigin =
await response.headers.get("x-authc-app-origin");
const appOrigin = await response.headers.get("x-authc-app-origin");
const resbody = await response.json();

if (response.ok) {
window.localStorage.setItem(
"ACCESS_TOKEN",
resbody.data.attributes.access_token,
);
window.localStorage.setItem("ACCESS_TOKEN", resbody.data.attributes.access_token);

window.location.href = appOrigin;
} else {
Expand All @@ -247,8 +217,7 @@
showError.value = true;

errorTitle.value = "Error";
errorDetail.value =
"There was an issue logging in, please try again";
errorDetail.value = "There was an issue logging in, please try again";
}
};

Expand Down
42 changes: 11 additions & 31 deletions client/auth/homePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,26 @@
<!-- Form -->
<div class="max-w-screen-xl px-4 py-16 mx-auto sm:px-6 lg:px-8">
<div class="max-w-lg mx-auto">
<form
@submit.prevent
action=""
class="p-4 mt-6 mb-0 rounded-lg shadow-lg sm:p-6 lg:p-8"
>
<form @submit.prevent action="" class="p-4 mt-6 mb-0 rounded-lg shadow-lg sm:p-6 lg:p-8">
<p class="text-2xl text-green-500">Success 🎉 !</p>
<p class="py-3 text-black">
Nice job getting started with AuthCompanion.
</p>
<p class="py-3 text-black">Nice job getting started with AuthCompanion.</p>

<p class="pt-8 text-black">
When you're ready, tell AuthC to redirect users after successful
login to your application's home page (instead of this temporary
one).
When you're ready, tell AuthC to redirect users after successful login to your application's home page
(instead of this temporary one).
</p>

<p class="py-3 text-black">
For a full guide on how to integrate and launch AuthCompanion, check
those sections in the docs:
<a
class="text-blue-600 underline hover:text-blue-800"
href="https://docs.authcompanion.com/"
For a full guide on how to integrate and launch AuthCompanion, check those sections in the docs:
<a class="text-blue-600 underline hover:text-blue-800" href="https://docs.authcompanion.com/"
>https://docs.authcompanion.com/</a
>
</p>

<p class="text-black">
After a successful login or account registration, AuthC provides
developers a user's access token which is used for managing your
user's session. The access token contains helpful information about
the user.
<a
class="text-blue-600 underline hover:text-blue-800"
:href="jwtDebugUrl"
After a successful login or account registration, AuthC provides developers a user's access token which is
used for managing your user's session. The access token contains helpful information about the user.
<a class="text-blue-600 underline hover:text-blue-800" :href="jwtDebugUrl"
>Decode the token's payload here to find out.</a
>
</p>
Expand All @@ -65,19 +51,13 @@
<div class="m-4 text-xs text-gray-400">
Powered by
<span class="underline">
<a href="https://github.com/authcompanion/authcompanion2"
>AuthCompanion</a
>
<a href="https://github.com/authcompanion/authcompanion2">AuthCompanion</a>
</span>
</div>
</div>
<!-- Scripts -->
<script type="module">
import {
createApp,
ref,
computed,
} from "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.esm-browser.prod.js";
import { createApp, ref, computed } from "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.esm-browser.prod.js";

createApp({
setup() {
Expand Down
Loading

0 comments on commit 3e07d84

Please sign in to comment.