From 33d0ac31bea314569c02322daf5ddd61b3c9d735 Mon Sep 17 00:00:00 2001 From: Mawoka Date: Sun, 7 Apr 2024 21:22:52 +0200 Subject: [PATCH] :construction: Maybe fix for overlapping text in old-school mode --- frontend/src/lib/editor/sidebar.svelte | 4 +- frontend/src/lib/play/question.svelte | 52 ++++++------ .../account/settings/security/+page.svelte | 78 +++++++++++++----- .../src/routes/docs/self-host/+page.svelte | 80 ++++++++++--------- 4 files changed, 130 insertions(+), 84 deletions(-) diff --git a/frontend/src/lib/editor/sidebar.svelte b/frontend/src/lib/editor/sidebar.svelte index fa5d1a1b..4ed745d1 100644 --- a/frontend/src/lib/editor/sidebar.svelte +++ b/frontend/src/lib/editor/sidebar.svelte @@ -210,7 +210,7 @@ SPDX-License-Identifier: MPL-2.0 d="m4.5 15.75 7.5-7.5 7.5 7.5" stroke-linecap="round" stroke-linejoin="round" - > + />
+ />
diff --git a/frontend/src/lib/play/question.svelte b/frontend/src/lib/play/question.svelte index 2960045d..8f517bbe 100644 --- a/frontend/src/lib/play/question.svelte +++ b/frontend/src/lib/play/question.svelte @@ -234,33 +234,35 @@ SPDX-License-Identifier: MPL-2.0 {/await} {:else if question.type === QuizQuestionType.TEXT} - -
-

Enter your answer

-
-
- + -
- -
-
- +

Enter your answer

+
+
+ { - selectAnswer(text_input); - }} - > - {$t('words.submit')} - + class="bg-gray-50 focus:ring text-gray-900 rounded-lg focus:ring-blue-500 block w-full p-2 dark:bg-gray-700 dark:text-white dark:focus:ring-blue-500 outline-none transition text-center disabled:opacity-50 disabled:cursor-not-allowed" + /> +
+ +
+
+ { + selectAnswer(text_input); + }} + > + {$t('words.submit')} + +
{:else if question.type === QuizQuestionType.RANGE} diff --git a/frontend/src/routes/account/settings/security/+page.svelte b/frontend/src/routes/account/settings/security/+page.svelte index f46cf0bd..4e400be3 100644 --- a/frontend/src/routes/account/settings/security/+page.svelte +++ b/frontend/src/routes/account/settings/security/+page.svelte @@ -36,7 +36,7 @@ SPDX-License-Identifier: MPL-2.0 if (!browser || user_data?.require_password === undefined) { return; } - const pw = require_password() + const pw = require_password(); const res = await fetch('/api/v1/users/2fa/require_password', { method: 'POST', headers: { @@ -48,13 +48,20 @@ SPDX-License-Identifier: MPL-2.0 }; const require_password = (): string => { - return prompt("Please enter your password to continue") - } + return prompt('Please enter your password to continue'); + }; const add_security_key = async () => { - const pw = require_password() - const res1 = await fetch('/api/v1/users/webauthn/add_key_init', {method: "POST", body: JSON.stringify({password: pw}), headers: { 'Content-Type': 'application/json' }}); - if (res1.status === 401) {alert("Password probably wrong"); return} + const pw = require_password(); + const res1 = await fetch('/api/v1/users/webauthn/add_key_init', { + method: 'POST', + body: JSON.stringify({ password: pw }), + headers: { 'Content-Type': 'application/json' } + }); + if (res1.status === 401) { + alert('Password probably wrong'); + return; + } if (!res1.ok) { throw Error('Response not ok'); } @@ -81,34 +88,62 @@ SPDX-License-Identifier: MPL-2.0 }; const remove_security_key = async (key_id: number) => { - const pw = require_password() - const res = await fetch(`/api/v1/users/webauthn/key/${key_id}`, { method: 'DELETE', body: JSON.stringify({password: pw}), headers: { 'Content-Type': 'application/json' } }); - if (res.status === 401) {alert("Password probably wrong"); return} + const pw = require_password(); + const res = await fetch(`/api/v1/users/webauthn/key/${key_id}`, { + method: 'DELETE', + body: JSON.stringify({ password: pw }), + headers: { 'Content-Type': 'application/json' } + }); + if (res.status === 401) { + alert('Password probably wrong'); + return; + } data = get_data(); }; const disable_totp = async () => { - const pw = require_password() - const res = await fetch(`/api/v1/users/2fa/totp`, { method: 'DELETE', body: JSON.stringify({password: pw}), headers: { 'Content-Type': 'application/json' } }); - if (res.status === 401) {alert("Password probably wrong"); return} + const pw = require_password(); + const res = await fetch(`/api/v1/users/2fa/totp`, { + method: 'DELETE', + body: JSON.stringify({ password: pw }), + headers: { 'Content-Type': 'application/json' } + }); + if (res.status === 401) { + alert('Password probably wrong'); + return; + } data = get_data(); }; const enable_totp = async () => { - const pw = require_password() - const res = await fetch('/api/v1/users/2fa/totp', { method: 'POST', body: JSON.stringify({password: pw}), headers: { 'Content-Type': 'application/json' } }); - if (res.status === 401) {alert("Password probably wrong"); return} + const pw = require_password(); + const res = await fetch('/api/v1/users/2fa/totp', { + method: 'POST', + body: JSON.stringify({ password: pw }), + headers: { 'Content-Type': 'application/json' } + }); + if (res.status === 401) { + alert('Password probably wrong'); + return; + } data = get_data(); totp_data = await res.json(); }; const get_backup_code = async () => { - const pw = require_password() + const pw = require_password(); if (!confirm('If you continue, your old backup-code will be removed.')) { return; } - const res = await fetch('/api/v1/users/2fa/backup_code', { method: 'POST', body: JSON.stringify({password: pw}), headers: { 'Content-Type': 'application/json' } }); - if (res.status === 401) {alert("Password probably wrong"); return} + const res = await fetch('/api/v1/users/2fa/backup_code', { + method: 'POST', + body: JSON.stringify({ password: pw }), + headers: { 'Content-Type': 'application/json' } + }); + if (res.status === 401) { + alert('Password probably wrong'); + return; + } backup_code = (await res.json()).code; }; @@ -130,7 +165,12 @@ SPDX-License-Identifier: MPL-2.0

{$t('security_settings.activate_2fa')}

-
+
{#if user_data.require_password}
diff --git a/frontend/src/routes/docs/self-host/+page.svelte b/frontend/src/routes/docs/self-host/+page.svelte index e596e7c0..18869730 100644 --- a/frontend/src/routes/docs/self-host/+page.svelte +++ b/frontend/src/routes/docs/self-host/+page.svelte @@ -3,7 +3,7 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka) SPDX-License-Identifier: MPL-2.0 --> -