From df017833a4e5f725be5dda52da72e96f1e319d0d Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Wed, 11 Mar 2020 13:54:13 +0100 Subject: [PATCH] Using prettier to format --- .editorconfig | 2 +- .vscode/extensions.json | 3 + src/Login/Redirect.svelte | 175 ++++--- src/Login/twofactors/codeInput.svelte | 50 +- src/Login/twofactors/push.svelte | 681 +++++++++++++------------- src/Login/twofactors/sms.svelte | 64 +-- src/Login/twofactors/toList.svelte | 17 +- src/Login/twofactors/u2f.svelte | 105 ++-- src/request.ts | 6 +- 9 files changed, 551 insertions(+), 552 deletions(-) create mode 100644 .vscode/extensions.json diff --git a/.editorconfig b/.editorconfig index 153d9a0..f8f5ab2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,7 +5,7 @@ indent_style = space indent_size = 3 charset = utf-8 trim_trailing_whitespace = false -insert_final_newline = false +insert_final_newline = true [*.svelte] indent_size = 2 \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..27c5166 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["esbenp.prettier-vscode"] +} diff --git a/src/Login/Redirect.svelte b/src/Login/Redirect.svelte index abb276c..9e4990b 100644 --- a/src/Login/Redirect.svelte +++ b/src/Login/Redirect.svelte @@ -1,100 +1,99 @@ + +
- - - - + + + +

{text}

- - \ No newline at end of file diff --git a/src/Login/twofactors/codeInput.svelte b/src/Login/twofactors/codeInput.svelte index 436a205..594669a 100644 --- a/src/Login/twofactors/codeInput.svelte +++ b/src/Login/twofactors/codeInput.svelte @@ -1,35 +1,33 @@
- - - - -
{error}
-
\ No newline at end of file + + + + +
{error}
+ diff --git a/src/Login/twofactors/push.svelte b/src/Login/twofactors/push.svelte index 2c30033..c3b92b8 100644 --- a/src/Login/twofactors/push.svelte +++ b/src/Login/twofactors/push.svelte @@ -1,393 +1,392 @@ -

SMS

-

A code was sent to your Device {device}

+

+ A code was sent to your Device + {device} +

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{error}
- \ No newline at end of file + diff --git a/src/Login/twofactors/sms.svelte b/src/Login/twofactors/sms.svelte index 36a5eff..ddd099a 100644 --- a/src/Login/twofactors/sms.svelte +++ b/src/Login/twofactors/sms.svelte @@ -1,49 +1,49 @@ -

SMS

{#if state === states.approve} -

Send SMS to {number}

- +

Send SMS to {number}

+ {:else} -

A code was sent to you. Please enter

- -
- state = states.approve}>Not received? +

A code was sent to you. Please enter

+ + +
+ (state = states.approve)}> + Not received? + {/if}
{error}
- \ No newline at end of file + diff --git a/src/Login/twofactors/toList.svelte b/src/Login/twofactors/toList.svelte index 3f0d9d5..f2d2451 100644 --- a/src/Login/twofactors/toList.svelte +++ b/src/Login/twofactors/toList.svelte @@ -1,13 +1,16 @@ +

- evt.preventDefault() || finish(false)}>Choose another Method -

\ No newline at end of file + evt.preventDefault() || finish(false)}> + Choose another Method + +

diff --git a/src/Login/twofactors/u2f.svelte b/src/Login/twofactors/u2f.svelte index e95cef5..58d26ac 100644 --- a/src/Login/twofactors/u2f.svelte +++ b/src/Login/twofactors/u2f.svelte @@ -1,72 +1,69 @@ -

U2F Security Key

This Method is currently not supported. Please choose another one!

- \ No newline at end of file + diff --git a/src/request.ts b/src/request.ts index d0d83e7..24e76bb 100644 --- a/src/request.ts +++ b/src/request.ts @@ -4,7 +4,7 @@ import { getCookie } from "./cookie"; // const baseURL = "http://localhost:3000"; const baseURL = ""; -export default async function request(endpoint: string, parameters: { [key: string]: string } = {}, method: "GET" | "POST" | "DELETE" | "PUT" = "GET", body?: any, authInParam = false) { +export default async function request(endpoint: string, parameters: { [key: string]: string } = {}, method: "GET" | "POST" | "DELETE" | "PUT" = "GET", body?: any, authInParam = false, redirect = false) { let pairs = []; if (authInParam) { @@ -33,9 +33,9 @@ export default async function request(endpoint: string, parameters: { [key: stri return e.json() }).then(data => { if (data.error) { - if (data.additional && data.additional.auth) { + if (redirect && data.additional && data.additional.auth) { let state = btoa(window.location.pathname + window.location.hash); - // window.location.href = `/login?state=${state}&base64=true`; + window.location.href = `/login?state=${state}&base64=true`; } return Promise.reject(new Error(data.error)) }