@ctx-core/auth0-ui 12.2.235 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/lib/{auth_script_html_.js → auth0__script__html_.js} +3 -3
- package/lib/auth0__script__html_.js.map +1 -0
- package/lib/auth0__ui__o__getContext.js +7 -0
- package/lib/auth0__ui__o__getContext.js.map +1 -0
- package/lib/auth0__ui__o_key.js +3 -0
- package/lib/auth0__ui__o_key.js.map +1 -0
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/src/auth0__script__html_.d.ts +2 -0
- package/lib/src/auth0__ui__o__getContext.d.ts +2 -0
- package/lib/src/auth0__ui__o_key.d.ts +1 -0
- package/lib/src/index.d.ts +3 -3
- package/lib/src/ui/Auth0_c.d.ts +22 -22
- package/lib/ui/Auth0.svelte +2 -2
- package/lib/ui/Auth0_Change_Password_Form.svelte +7 -7
- package/lib/ui/Auth0_Dialog_Close.svelte +2 -2
- package/lib/ui/Auth0_Forgot_Password_Form.svelte +4 -4
- package/lib/ui/Auth0_Login_Form.svelte +3 -3
- package/lib/ui/Auth0_Signup_Form.svelte +5 -5
- package/lib/ui/Auth0_c.js +33 -33
- package/lib/ui/Auth0_c.js.map +1 -1
- package/package.json +3 -3
- package/src/{auth_script_html_.ts → auth0__script__html_.ts} +4 -3
- package/src/auth0__ui__o__getContext.ts +6 -0
- package/src/auth0__ui__o_key.ts +1 -0
- package/src/index.ts +3 -3
- package/src/ui/Auth0.svelte +2 -2
- package/src/ui/Auth0_Change_Password_Form.svelte +7 -7
- package/src/ui/Auth0_Dialog_Close.svelte +2 -2
- package/src/ui/Auth0_Forgot_Password_Form.svelte +4 -4
- package/src/ui/Auth0_Login_Form.svelte +3 -3
- package/src/ui/Auth0_Signup_Form.svelte +5 -5
- package/src/ui/Auth0_c.ts +45 -45
- package/COMMIT_EDITMSG +0 -1
- package/lib/auth0_ui_ctx_key.js +0 -3
- package/lib/auth0_ui_ctx_key.js.map +0 -1
- package/lib/auth_script_html_.js.map +0 -1
- package/lib/getContext_auth0_ui_ctx.js +0 -7
- package/lib/getContext_auth0_ui_ctx.js.map +0 -1
- package/lib/src/auth0_ui_ctx_key.d.ts +0 -1
- package/lib/src/auth_script_html_.d.ts +0 -2
- package/lib/src/getContext_auth0_ui_ctx.d.ts +0 -2
- package/src/auth0_ui_ctx_key.ts +0 -1
- package/src/getContext_auth0_ui_ctx.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ctx-core/auth0-ui
|
|
2
2
|
|
|
3
|
+
## 13.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- name convention updates
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @ctx-core/auth0@35.1.7
|
|
13
|
+
|
|
14
|
+
## 12.2.236
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- @ctx-core/auth0: ^35.1.5 -> ^35.1.6
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @ctx-core/auth0-management@9.1.7
|
|
21
|
+
|
|
3
22
|
## 12.2.235
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function auth0__script__html_() {
|
|
2
2
|
return `
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
@@ -30,6 +30,6 @@ export function auth_script_html_() {
|
|
|
30
30
|
</script>
|
|
31
31
|
`.trim();
|
|
32
32
|
}
|
|
33
|
-
export { auth_script_html_ as _auth_script_html,
|
|
33
|
+
export { auth0__script__html_ as auth_script_html_, auth0__script__html_ as _auth_script_html, auth0__script__html_ as _html__script__auth, };
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=auth0__script__html_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/auth0__script__html_.ts"],"sourcesContent":["export function auth0__script__html_():string {\n\treturn `\n<script>\n\t(function() {\n\t\tvar location = window.location\n\t\tvar search = location.search\n\t\tvar search_values = _values(search.substr(1))\n\t\tvar hash = location.hash\n\t\tvar auth0_token = _values(hash.substr(1))\n\t\tvar auth0_token_json = JSON.stringify(auth0_token)\n\t\tvar redirect_url =\n\t\t\t\t\tsearch_values\n\t\t\t\t\t&& search_values.redirect_url\n\t\tlocalStorage.setItem('auth0_token_json', auth0_token_json)\n\t\tif (redirect_url) {\n\t\t\tlocation.href = redirect_url\n\t\t}\n\t\tfunction _values(string) {\n\t\t\tvar segments = string.split('&')\n\t\t\tvar values = {}\n\t\t\tfor (var i=0; i < segments.length; i++) {\n\t\t\t\tvar pair = segments[i].split('=')\n\t\t\t\tvar key = decodeURIComponent(pair[0])\n\t\t\t\tvar value = decodeURIComponent(pair[1])\n\t\t\t\tvalues[key] = value\n\t\t\t}\n\t\t\treturn values\n\t\t}\n\t})()\n</script>\n\t`.trim()\n}\nexport {\n\tauth0__script__html_ as auth_script_html_,\n\tauth0__script__html_ as _auth_script_html,\n\tauth0__script__html_ as _html__script__auth,\n}\n"],"names":["auth0__script__html_","trim","auth_script_html_","_auth_script_html","_html__script__auth"],"mappings":"AAAA,OAAO,SAASA,uBAA8B;IAC7C,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BR,CAAC,CAACC,IAAI;AACP,CAAC;AACD,SACCD,wBAAwBE,iBAAiB,EACzCF,wBAAwBG,iBAAiB,EACzCH,wBAAwBI,mBAAmB,KAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/auth0__ui__o__getContext.ts"],"sourcesContent":["import { getContext } from 'svelte'\nimport type { Ctx } from '@ctx-core/object'\nimport { auth0__ui__o_key } from './auth0__ui__o_key.js'\nexport function auth0__ui__o__getContext() {\n return getContext(auth0__ui__o_key) as Ctx\n}\n"],"names":["getContext","auth0__ui__o_key","auth0__ui__o__getContext"],"mappings":"AAAA,SAASA,UAAU,QAAQ,SAAQ;AAEnC,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,OAAO,SAASC,2BAA2B;IACzC,OAAOF,WAAWC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/auth0__ui__o_key.ts"],"sourcesContent":["export const auth0__ui__o_key = Symbol('auth0__ui__o')\n"],"names":["auth0__ui__o_key","Symbol"],"mappings":"AAAA,OAAO,MAAMA,mBAAmBC,OAAO,gBAAe"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './auth0__ui__o_key.js';
|
|
2
|
+
export * from './auth0__script__html_.js';
|
|
3
|
+
export * from './auth0__ui__o__getContext.js';
|
|
4
4
|
export * from './ui/index.js';
|
|
5
5
|
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './auth0__ui__o_key.js'\nexport * from './auth0__script__html_.js'\nexport * from './auth0__ui__o__getContext.js'\nexport * from './ui/index.js'\n"],"names":[],"mappings":"AAAA,cAAc,wBAAuB;AACrC,cAAc,4BAA2B;AACzC,cAAc,gCAA+B;AAC7C,cAAc,gBAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const auth0__ui__o_key: unique symbol;
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './auth0__ui__o_key.js';
|
|
2
|
+
export * from './auth0__script__html_.js';
|
|
3
|
+
export * from './auth0__ui__o__getContext.js';
|
|
4
4
|
export * from './ui/index.js';
|
package/lib/src/ui/Auth0_c.d.ts
CHANGED
|
@@ -4,44 +4,44 @@ import type { Ctx } from '@ctx-core/object';
|
|
|
4
4
|
export declare class Auth0_c {
|
|
5
5
|
protected ctx: Ctx;
|
|
6
6
|
constructor(ctx: Ctx);
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
7
|
+
readonly auth0__login__body_: (data: any) => login__password_realm__body_T;
|
|
8
|
+
readonly auth0__login__password_realm__body_: (data: any) => login__password_realm__body_T;
|
|
9
|
+
readonly auth0__signup__body_: (data: any) => signup__password_realm__body_T;
|
|
10
|
+
readonly auth0__signup__password_realm__body_: (data: any) => signup__password_realm__body_T;
|
|
11
|
+
readonly auth0__opened__class: import("@ctx-core/nanostores").ReadableAtom_<import("@ctx-core/auth0").auth0_opened_T>;
|
|
12
|
+
readonly auth0__token__json_: import("@ctx-core/nanostores").WritableAtom_<string | import("@ctx-core/function").nullish>;
|
|
13
|
+
readonly auth0__token__error_: import("@ctx-core/nanostores").WritableAtom_<import("@ctx-core/auth0").auth0_token_error_T>;
|
|
14
14
|
readonly auth0__close: () => void;
|
|
15
15
|
readonly onMount: (root: HTMLElement) => Promise<void>;
|
|
16
|
-
readonly login: (data: auth0__login_data_T,
|
|
17
|
-
readonly signup: (data: auth0__signup_data_T,
|
|
16
|
+
readonly login: (data: auth0__login_data_T, forms__clear__schedule?: () => void) => Promise<void>;
|
|
17
|
+
readonly signup: (data: auth0__signup_data_T, forms__clear__schedule?: () => void) => Promise<void>;
|
|
18
18
|
readonly change_password: (form: {
|
|
19
19
|
password: string;
|
|
20
|
-
},
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
25
|
-
readonly
|
|
26
|
-
readonly
|
|
20
|
+
}, forms__clear__schedule?: () => void) => Promise<void>;
|
|
21
|
+
readonly forms__clear__schedule_: (root: HTMLElement) => void;
|
|
22
|
+
readonly forms__clear__schedule: (root: HTMLElement) => void;
|
|
23
|
+
readonly signup__onsubmit: (event: Event, ctx: signup__onsubmit__o_T, forms__clear__schedule?: () => void) => Promise<false | undefined>;
|
|
24
|
+
readonly login__onsubmit: (event: Event, ctx: login__onsubmit__o_T, forms__clear__schedule?: () => void) => Promise<void>;
|
|
25
|
+
readonly forgot_password__onsubmit: (event: Event, ctx: forgot_password__onsubmit__o_T) => Promise<void>;
|
|
26
|
+
readonly change_password__onsubmit: (event: Event, ctx: change_password__onsubmit__o_T, forms__clear__schedule?: typeof noop) => Promise<void>;
|
|
27
27
|
readonly onclose: (event: MouseEvent) => Promise<void>;
|
|
28
28
|
}
|
|
29
|
-
export interface
|
|
29
|
+
export interface signup__password_realm__body_T extends auth0__signup_data_T, auth0__client_id__body_T, auth0__passwordless_start__fetch__body_T, password_realm__body_T, auth0__grant_type__body_T, auth0__oauth_token__fetch__body_T {
|
|
30
30
|
}
|
|
31
|
-
export interface
|
|
31
|
+
export interface login__password_realm__body_T extends auth0__login_data_T, auth0__client_id__body_T, auth0__passwordless_start__fetch__body_T, password_realm__body_T, auth0__grant_type__body_T, auth0__oauth_token__fetch__body_T {
|
|
32
32
|
}
|
|
33
|
-
export interface
|
|
33
|
+
export interface change_password__onsubmit__o_T {
|
|
34
34
|
password_input: HTMLInputElement;
|
|
35
35
|
password_confirmation_input: HTMLInputElement;
|
|
36
36
|
}
|
|
37
|
-
export interface
|
|
37
|
+
export interface forgot_password__onsubmit__o_T {
|
|
38
38
|
email_input: HTMLInputElement;
|
|
39
39
|
}
|
|
40
|
-
export interface
|
|
40
|
+
export interface login__onsubmit__o_T {
|
|
41
41
|
username_login_input: HTMLInputElement;
|
|
42
42
|
password_login_input: HTMLInputElement;
|
|
43
43
|
}
|
|
44
|
-
export interface
|
|
44
|
+
export interface signup__onsubmit__o_T {
|
|
45
45
|
email_input: HTMLInputElement;
|
|
46
46
|
password_input: HTMLInputElement;
|
|
47
47
|
password_confirmation_input: HTMLInputElement;
|
package/lib/ui/Auth0.svelte
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
auth0__forgot_password__check_email__opened__, auth0__change_password__opened__
|
|
6
6
|
} from '@ctx-core/auth0'
|
|
7
7
|
import { ctx_ } from '@ctx-core/object'
|
|
8
|
-
import {
|
|
8
|
+
import { auth0__ui__o_key } from '../auth0__ui__o_key.js'
|
|
9
9
|
import { Auth0_c } from './Auth0_c.js'
|
|
10
10
|
import Auth0_Change_Password_Form from './Auth0_Change_Password_Form.svelte'
|
|
11
11
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
@@ -14,7 +14,7 @@ import Auth0_Forgot_Password_Form from './Auth0_Forgot_Password_Form.svelte'
|
|
|
14
14
|
import Auth0_Login_Form from './Auth0_Login_Form.svelte'
|
|
15
15
|
import Auth0_Signup_Form from './Auth0_Signup_Form.svelte'
|
|
16
16
|
export let ctx = ctx_(), dialog = false
|
|
17
|
-
setContext(
|
|
17
|
+
setContext(auth0__ui__o_key, ctx)
|
|
18
18
|
const auth0_change_password_opened_ = auth0__change_password__opened__(ctx)
|
|
19
19
|
const auth0_opened_class_ = auth0__opened__class__(ctx)
|
|
20
20
|
const auth0_forgot_password_check_email_opened_ = auth0__forgot_password__check_email__opened__(ctx)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher } from 'svelte'
|
|
3
3
|
import { AUTH0_DOMAIN__, auth0__token__error__ } from '@ctx-core/auth0'
|
|
4
|
-
import {
|
|
4
|
+
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
5
5
|
import { Auth0_c } from './Auth0_c.js'
|
|
6
6
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
7
|
-
const ctx =
|
|
7
|
+
const ctx = auth0__ui__o__getContext()
|
|
8
8
|
const dispatch = createEventDispatcher()
|
|
9
9
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
10
10
|
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
-
const
|
|
11
|
+
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root:HTMLDivElement
|
|
14
14
|
let password_input:HTMLInputElement
|
|
@@ -17,13 +17,13 @@ let password_error:any|undefined //region
|
|
|
17
17
|
$: password_error = $auth0_token_error_?.password //endregion
|
|
18
18
|
let password_error_confirmation:string|undefined //region
|
|
19
19
|
$: password_error_confirmation = $auth0_token_error_?.password_confirmation //endregion
|
|
20
|
-
async function
|
|
20
|
+
async function change_password__onsubmit(event:FormDataEvent) {
|
|
21
21
|
dispatch('submit__start')
|
|
22
22
|
try {
|
|
23
|
-
await _.
|
|
23
|
+
await _.change_password__onsubmit(event, {
|
|
24
24
|
password_input,
|
|
25
25
|
password_confirmation_input,
|
|
26
|
-
}, ()=>_.
|
|
26
|
+
}, ()=>_.forms__clear__schedule(root))
|
|
27
27
|
dispatch('success')
|
|
28
28
|
} catch (error) {
|
|
29
29
|
dispatch('error', { error })
|
|
@@ -41,7 +41,7 @@ async function onsubmit_change_password(event:FormDataEvent) {
|
|
|
41
41
|
action="https://{$AUTH0_DOMAIN_}/dbconnections/change_password"
|
|
42
42
|
accept-charset="UTF-8"
|
|
43
43
|
method="post"
|
|
44
|
-
on:submit|preventDefault={
|
|
44
|
+
on:submit|preventDefault={change_password__onsubmit}
|
|
45
45
|
>
|
|
46
46
|
{#if $auth0_token_error_}
|
|
47
47
|
<ul>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { CloseDialogHandle } from '@ctx-core/dialog-ui-svelte'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
4
4
|
import { Auth0_c } from './Auth0_c.js'
|
|
5
|
-
const ctx =
|
|
5
|
+
const ctx = auth0__ui__o__getContext()
|
|
6
6
|
const _ = new Auth0_c(ctx)
|
|
7
7
|
</script>
|
|
8
8
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { AUTH0_DOMAIN__, auth0__token__error__, auth0__login__open, auth0__signup__open } from '@ctx-core/auth0'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
4
4
|
import { Auth0_c } from './Auth0_c.js'
|
|
5
5
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
6
6
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
7
|
-
const ctx =
|
|
7
|
+
const ctx = auth0__ui__o__getContext()
|
|
8
8
|
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
9
|
-
const
|
|
9
|
+
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
10
10
|
const _ = new Auth0_c(ctx)
|
|
11
11
|
let email_input:HTMLInputElement, error:typeof $auth0_token_error_?.error
|
|
12
12
|
$: error = $auth0_token_error_?.error
|
|
@@ -19,7 +19,7 @@ $: error = $auth0_token_error_?.error
|
|
|
19
19
|
action="https://{$AUTH0_DOMAIN_}/passwordless/start"
|
|
20
20
|
accept-charset="UTF-8"
|
|
21
21
|
method="post"
|
|
22
|
-
on:submit={event => _.
|
|
22
|
+
on:submit={event => _.forgot_password__onsubmit(event, { email_input })}
|
|
23
23
|
>
|
|
24
24
|
{#if $auth0_token_error_}
|
|
25
25
|
<ul>
|
|
@@ -6,7 +6,7 @@ import { type Ctx } from '@ctx-core/object'
|
|
|
6
6
|
import { Auth0_c } from './Auth0_c.js'
|
|
7
7
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
8
|
export let ctx:Ctx, error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
|
-
const
|
|
9
|
+
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
10
10
|
const auth0_token_error_txt_ = auth0__token__error_txt__(ctx)
|
|
11
11
|
const AUTH0_DOMAIN = AUTH0_DOMAIN__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
@@ -26,10 +26,10 @@ $: error_password = $auth0_token_error_?.password //endregion
|
|
|
26
26
|
accept-charset="UTF-8"
|
|
27
27
|
method="post"
|
|
28
28
|
on:submit={event =>
|
|
29
|
-
_.
|
|
29
|
+
_.login__onsubmit(event, {
|
|
30
30
|
username_login_input,
|
|
31
31
|
password_login_input
|
|
32
|
-
}, ()=>_.
|
|
32
|
+
}, ()=>_.forms__clear__schedule(root))}
|
|
33
33
|
>
|
|
34
34
|
{#if $auth0_token_error_txt_}
|
|
35
35
|
<ul>
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AUTH0_DOMAIN__, auth0__token__error__, auth0__forgot_password__open, auth0__login__open,
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
|
-
import {
|
|
5
|
+
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
6
6
|
import { Auth0_c } from './Auth0_c.js'
|
|
7
7
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
8
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
|
-
const ctx =
|
|
9
|
+
const ctx = auth0__ui__o__getContext()
|
|
10
10
|
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
-
const
|
|
11
|
+
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root, signup_email_input, signup_password_input, signup_password_confirmation_input
|
|
14
14
|
let error_username:string|undefined //region
|
|
@@ -37,11 +37,11 @@ $: {
|
|
|
37
37
|
accept-charset="UTF-8"
|
|
38
38
|
method="post"
|
|
39
39
|
on:submit={event =>
|
|
40
|
-
_.
|
|
40
|
+
_.signup__onsubmit(event, {
|
|
41
41
|
signup_email_input,
|
|
42
42
|
signup_password_input,
|
|
43
43
|
signup_password_confirmation_input
|
|
44
|
-
}, _.
|
|
44
|
+
}, _.forms__clear__schedule(root))
|
|
45
45
|
}
|
|
46
46
|
>
|
|
47
47
|
{#if $auth0_token_error_}
|
package/lib/ui/Auth0_c.js
CHANGED
|
@@ -5,35 +5,35 @@ import { onDestroy } from 'svelte';
|
|
|
5
5
|
export class Auth0_c {
|
|
6
6
|
constructor(ctx){
|
|
7
7
|
this.ctx = ctx;
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
8
|
+
this.auth0__login__body_ = (data)=>auth0__body_(this.ctx, data);
|
|
9
|
+
this.auth0__login__password_realm__body_ = (data)=>password_realm__body_(this.ctx, this.auth0__login__body_(data));
|
|
10
|
+
this.auth0__signup__body_ = (data)=>auth0__body_(this.ctx, data);
|
|
11
|
+
this.auth0__signup__password_realm__body_ = (data)=>password_realm__body_(this.ctx, this.auth0__signup__body_(data));
|
|
12
|
+
this.auth0__opened__class = auth0__opened__class__(this.ctx);
|
|
13
|
+
this.auth0__token__json_ = auth0__token__json__(this.ctx);
|
|
14
|
+
this.auth0__token__error_ = auth0__token__error__(this.ctx);
|
|
15
15
|
this.auth0__close = ()=>auth0__close(this.ctx);
|
|
16
16
|
this.onMount = async (root)=>{
|
|
17
17
|
if (has_dom) {
|
|
18
|
-
const unsubscribe = this.
|
|
18
|
+
const unsubscribe = this.auth0__opened__class.subscribe(()=>this.forms__clear__schedule(root));
|
|
19
19
|
onDestroy(unsubscribe);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
this.login = async (data,
|
|
23
|
-
const [auth0_token, response] = await auth0__oauth_token__fetch_post(this.ctx, this.
|
|
22
|
+
this.login = async (data, forms__clear__schedule = ()=>{})=>{
|
|
23
|
+
const [auth0_token, response] = await auth0__oauth_token__fetch_post(this.ctx, this.auth0__login__password_realm__body_(data));
|
|
24
24
|
if (response.ok) {
|
|
25
25
|
const auth0_token_json = JSON.stringify(auth0_token);
|
|
26
|
-
this.
|
|
27
|
-
|
|
26
|
+
this.auth0__token__json_.$ = auth0_token_json;
|
|
27
|
+
forms__clear__schedule();
|
|
28
28
|
this.auth0__close();
|
|
29
29
|
} else {
|
|
30
30
|
const auth_token_error = auth0_token;
|
|
31
|
-
this.
|
|
31
|
+
this.auth0__token__error_.$ = auth_token_error;
|
|
32
32
|
auth0__token__error__logout(this.ctx, auth_token_error);
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
this.signup = async (data,
|
|
36
|
-
const [auth0_userinfo] = await auth0__dbconnections_signup__fetch_get(this.ctx, this.
|
|
35
|
+
this.signup = async (data, forms__clear__schedule = ()=>{})=>{
|
|
36
|
+
const [auth0_userinfo] = await auth0__dbconnections_signup__fetch_get(this.ctx, this.auth0__signup__password_realm__body_(data));
|
|
37
37
|
const auth0_userinfo_Auth0Error = auth0_userinfo;
|
|
38
38
|
const { statusCode } = auth0_userinfo_Auth0Error;
|
|
39
39
|
if (statusCode) {
|
|
@@ -45,13 +45,13 @@ export class Auth0_c {
|
|
|
45
45
|
auth0__token__error__logout(this.ctx, auth0_token_error);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
forms__clear__schedule();
|
|
49
49
|
await this.login({
|
|
50
50
|
username: data.email,
|
|
51
51
|
password: data.password
|
|
52
|
-
},
|
|
52
|
+
}, forms__clear__schedule);
|
|
53
53
|
};
|
|
54
|
-
this.change_password = async (form,
|
|
54
|
+
this.change_password = async (form, forms__clear__schedule = ()=>{})=>{
|
|
55
55
|
const { password } = form;
|
|
56
56
|
let error;
|
|
57
57
|
try {
|
|
@@ -78,20 +78,20 @@ export class Auth0_c {
|
|
|
78
78
|
auth0__token__error__logout(this.ctx, auth0_token_error);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
forms__clear__schedule();
|
|
82
82
|
this.auth0__close();
|
|
83
83
|
};
|
|
84
|
-
this.
|
|
85
|
-
return ()=>this.
|
|
84
|
+
this.forms__clear__schedule_ = (root)=>{
|
|
85
|
+
return ()=>this.forms__clear__schedule(root);
|
|
86
86
|
};
|
|
87
|
-
this.
|
|
87
|
+
this.forms__clear__schedule = (root)=>{
|
|
88
88
|
setTimeout(()=>{
|
|
89
89
|
auth0__token__error__clear(this.ctx);
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
inputs__clear(dom_a_('input[type=text]', root));
|
|
91
|
+
inputs__clear(dom_a_('input[type=password]', root));
|
|
92
92
|
}, 100);
|
|
93
93
|
};
|
|
94
|
-
this.
|
|
94
|
+
this.signup__onsubmit = async (event, ctx, forms__clear__schedule = ()=>{})=>{
|
|
95
95
|
event.preventDefault();
|
|
96
96
|
const { email_input , password_input , password_confirmation_input } = ctx;
|
|
97
97
|
const email = email_input.value;
|
|
@@ -109,10 +109,10 @@ export class Auth0_c {
|
|
|
109
109
|
await this.signup({
|
|
110
110
|
email,
|
|
111
111
|
password
|
|
112
|
-
},
|
|
112
|
+
}, forms__clear__schedule);
|
|
113
113
|
return;
|
|
114
114
|
};
|
|
115
|
-
this.
|
|
115
|
+
this.login__onsubmit = async (event, ctx, forms__clear__schedule = ()=>{})=>{
|
|
116
116
|
event.preventDefault();
|
|
117
117
|
const { username_login_input , password_login_input } = ctx;
|
|
118
118
|
const username = username_login_input.value;
|
|
@@ -120,9 +120,9 @@ export class Auth0_c {
|
|
|
120
120
|
await this.login({
|
|
121
121
|
username,
|
|
122
122
|
password
|
|
123
|
-
},
|
|
123
|
+
}, forms__clear__schedule);
|
|
124
124
|
};
|
|
125
|
-
this.
|
|
125
|
+
this.forgot_password__onsubmit = async (event, ctx)=>{
|
|
126
126
|
event.preventDefault();
|
|
127
127
|
const { email_input } = ctx;
|
|
128
128
|
const email = email_input.value;
|
|
@@ -136,10 +136,10 @@ export class Auth0_c {
|
|
|
136
136
|
auth0__token__error__logout(this.ctx, auth0_token_error);
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
await auth0__passwordless_start__fetch_post(this.ctx, this.
|
|
139
|
+
await auth0__passwordless_start__fetch_post(this.ctx, this.auth0__login__body_(data));
|
|
140
140
|
auth0__forgot_password__check_email__open(this.ctx);
|
|
141
141
|
};
|
|
142
|
-
this.
|
|
142
|
+
this.change_password__onsubmit = async (event, ctx, forms__clear__schedule = noop)=>{
|
|
143
143
|
event.preventDefault();
|
|
144
144
|
const { password_input , password_confirmation_input } = ctx;
|
|
145
145
|
const password = password_input.value;
|
|
@@ -154,7 +154,7 @@ export class Auth0_c {
|
|
|
154
154
|
}
|
|
155
155
|
return await this.change_password({
|
|
156
156
|
password
|
|
157
|
-
},
|
|
157
|
+
}, forms__clear__schedule);
|
|
158
158
|
};
|
|
159
159
|
this.onclose = async (event)=>{
|
|
160
160
|
event.preventDefault();
|
|
@@ -162,7 +162,7 @@ export class Auth0_c {
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function inputs__clear(inputs) {
|
|
166
166
|
for(let i = 0; i < inputs.length; i++){
|
|
167
167
|
const input = inputs[i];
|
|
168
168
|
input.value = '';
|
package/lib/ui/Auth0_c.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/Auth0_c.ts"],"sourcesContent":["import type {\n\tauth0__client_id__body_T,\n\tauth0__grant_type__body_T,\n\tauth0__login_data_T,\n\tpassword_realm__body_T,\n\tauth0__oauth_token__fetch__body_T,\n\tauth0__passwordless_start__fetch__body_T,\n\tauth0__passwordless_start__fetch__optional_body_T,\n\tauth0__signup_data_T\n} from '@ctx-core/auth0'\nimport {\n\tauth0__body_,\n\tauth0__opened__class__,\n\tauth0__token__error__,\n\tauth0__token__json__,\n\tauth0__token__error__clear,\n\tauth0__close,\n\tauth0__token__error__logout,\n\tauth0__forgot_password__check_email__open,\n\tauth0__login__open,\n\tpassword_realm__body_,\n\tauth0__change_password__fetch_post,\n\tauth0__dbconnections_signup__fetch_get,\n\tauth0__oauth_token__fetch_post,\n\tauth0__passwordless_start__fetch_post,\n\tauth0__change_password__validate,\n\tauth0__forgot_password__validate,\n\tauth0__signup__validate\n} from '@ctx-core/auth0'\nimport { dom_a_, has_dom } from '@ctx-core/dom'\nimport { noop } from '@ctx-core/function'\nimport type { Ctx } from '@ctx-core/object'\nimport type { Auth0Error } from 'auth0-js'\nimport { onDestroy } from 'svelte'\nexport class Auth0_c {\n\tconstructor(protected ctx:Ctx) {}\n\treadonly login_auth0_body_ = (data:any)=>\n\t\tauth0__body_<login_data_password_realm_body_I>(\n\t\t\tthis.ctx, data\n\t\t)\n\treadonly login_password_realm_body_ = (data:any)=>\n\t\tpassword_realm__body_<login_data_password_realm_body_I>(\n\t\t\tthis.ctx,\n\t\t\tthis.login_auth0_body_(data)\n\t\t)\n\treadonly signup_auth0_body_ = (data:any)=>\n\t\tauth0__body_<signup_data_password_realm_body_I>(this.ctx, data) as signup_data_password_realm_body_I\n\treadonly signup_password_realm_body_ = (data:any)=>\n\t\tpassword_realm__body_<signup_data_password_realm_body_I>(this.ctx, this.signup_auth0_body_(data))\n\treadonly auth0_opened_class = auth0__opened__class__(this.ctx)\n\treadonly auth0_token_json_ = auth0__token__json__(this.ctx)\n\treadonly auth0_token_error_ = auth0__token__error__(this.ctx)\n\treadonly auth0__close = ()=>auth0__close(this.ctx)\n\treadonly onMount = async (root:HTMLElement)=>{\n\t\tif (has_dom) {\n\t\t\tconst unsubscribe =\n\t\t\t\tthis.auth0_opened_class.subscribe(()=>this.schedule_forms_clear(root))\n\t\t\tonDestroy(unsubscribe)\n\t\t}\n\t}\n\treadonly login = async (data:auth0__login_data_T, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_token, response] = await auth0__oauth_token__fetch_post(\n\t\t\tthis.ctx, this.login_password_realm_body_(data)\n\t\t)\n\t\tif (response.ok) {\n\t\t\tconst auth0_token_json = JSON.stringify(auth0_token)\n\t\t\tthis.auth0_token_json_.$ = auth0_token_json\n\t\t\tschedule_forms_clear()\n\t\t\tthis.auth0__close()\n\t\t} else {\n\t\t\tconst auth_token_error = auth0_token as Auth0Error\n\t\t\tthis.auth0_token_error_.$ = auth_token_error\n\t\t\tauth0__token__error__logout(this.ctx, auth_token_error)\n\t\t}\n\t}\n\treadonly signup = async (data:auth0__signup_data_T, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_userinfo] = await auth0__dbconnections_signup__fetch_get(\n\t\t\tthis.ctx,\n\t\t\tthis.signup_password_realm_body_(data))\n\t\tconst auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error\n\t\tconst { statusCode } = auth0_userinfo_Auth0Error\n\t\tif (statusCode) {\n\t\t\tconst {\n\t\t\t\tcode,\n\t\t\t\tdescription\n\t\t\t} = auth0_userinfo_Auth0Error\n\t\t\tconst email =\n\t\t\t\tcode === 'user_exists'\n\t\t\t\t? 'This Email is already signed up'\n\t\t\t\t: description || ''\n\t\t\tconst auth0_token_error = { email }\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tschedule_forms_clear()\n\t\tawait this.login({\n\t\t\tusername: data.email,\n\t\t\tpassword: data.password,\n\t\t}, schedule_forms_clear)\n\t}\n\treadonly change_password = async (form:{ password:string }, schedule_forms_clear = ()=>{})=>{\n\t\tconst { password } = form\n\t\tlet error\n\t\ttry {\n\t\t\tconst [response_json, response] = await auth0__change_password__fetch_post(this.ctx, password)\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status == 401) {\n\t\t\t\t\tauth0__login__open(this.ctx)\n\t\t\t\t\tconst auth0_token_error = { username: 'Authentication Error - Log in' }\n\t\t\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terror = response_json.error || 'Error changing Password'\n\t\t\t}\n\t\t} catch (e:any) {\n\t\t\tconsole.warn(e)\n\t\t\terror = e.message\n\t\t}\n\t\tif (error) {\n\t\t\tconst auth0_token_error = { password: error }\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tschedule_forms_clear()\n\t\tthis.auth0__close()\n\t}\n\treadonly schedule_forms_clear_:(root:HTMLElement)=>void = (root:HTMLElement)=>{\n\t\treturn ()=>this.schedule_forms_clear(root)\n\t}\n\treadonly schedule_forms_clear = (root:HTMLElement)=>{\n\t\tsetTimeout(()=>{\n\t\t\tauth0__token__error__clear(this.ctx)\n\t\t\tclear_inputs(dom_a_('input[type=text]', root))\n\t\t\tclear_inputs(dom_a_('input[type=password]', root))\n\t\t}, 100)\n\t}\n\treadonly onsubmit_signup = async (event:Event, ctx:onsubmit_signup_Ctx, schedule_forms_clear = ()=>{})=>{\n\t\tevent.preventDefault()\n\t\tconst {\n\t\t\temail_input,\n\t\t\tpassword_input,\n\t\t\tpassword_confirmation_input,\n\t\t} = ctx\n\t\tconst email = email_input.value\n\t\tconst password = password_input.value\n\t\tconst password_confirmation = password_confirmation_input.value\n\t\tconst auth0_token_error =\n\t\t\tauth0__signup__validate({\n\t\t\t\temail,\n\t\t\t\tpassword,\n\t\t\t\tpassword_confirmation\n\t\t\t})\n\t\tif (auth0_token_error) {\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\treturn false\n\t\t}\n\t\tawait this.signup({\n\t\t\temail,\n\t\t\tpassword\n\t\t}, schedule_forms_clear)\n\t\treturn\n\t}\n\treadonly onsubmit_login = async (event:Event, ctx:onsubmit_login_Ctx, schedule_forms_clear = ()=>{})=>{\n\t\tevent.preventDefault()\n\t\tconst { username_login_input, password_login_input } = ctx\n\t\tconst username = username_login_input.value\n\t\tconst password = password_login_input.value\n\t\tawait this.login({ username, password }, schedule_forms_clear)\n\t}\n\treadonly onsubmit_forgot_password = async (event:Event, ctx:onsubmit_forgot_password_Ctx)=>{\n\t\tevent.preventDefault()\n\t\tconst { email_input } = ctx\n\t\tconst email = email_input.value\n\t\tconst data:auth0__passwordless_start__fetch__optional_body_T = {\n\t\t\tconnection: 'email',\n\t\t\tsend: 'link',\n\t\t\temail\n\t\t}\n\t\tconst auth0_token_error = auth0__forgot_password__validate(data)\n\t\tif (auth0_token_error) {\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tawait auth0__passwordless_start__fetch_post(\n\t\t\tthis.ctx, this.login_auth0_body_(data) as auth0__passwordless_start__fetch__body_T\n\t\t)\n\t\tauth0__forgot_password__check_email__open(this.ctx)\n\t}\n\treadonly onsubmit_change_password = async (\n\t\tevent:Event, ctx:onsubmit_change_password_Ctx, schedule_forms_clear = noop\n\t)=>{\n\t\tevent.preventDefault()\n\t\tconst {\n\t\t\tpassword_input,\n\t\t\tpassword_confirmation_input,\n\t\t} = ctx\n\t\tconst password = password_input.value\n\t\tconst password_confirmation = password_confirmation_input.value\n\t\tconst auth0_token_error =\n\t\t\tauth0__change_password__validate(\n\t\t\t\t{\n\t\t\t\t\tpassword,\n\t\t\t\t\tpassword_confirmation\n\t\t\t\t})\n\t\tif (auth0_token_error) {\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\tthrow auth0_token_error\n\t\t}\n\t\treturn await this.change_password({ password }, schedule_forms_clear)\n\t}\n\treadonly onclose = async (event:MouseEvent)=>{\n\t\tevent.preventDefault()\n\t\tthis.auth0__close()\n\t}\n}\nfunction clear_inputs(inputs:NodeList) {\n\tfor (let i = 0; i < inputs.length; i++) {\n\t\tconst input = inputs[i] as HTMLInputElement\n\t\tinput.value = ''\n\t}\n}\nexport interface signup_data_password_realm_body_I\n\textends auth0__signup_data_T,\n\t\tauth0__client_id__body_T,\n\t\tauth0__passwordless_start__fetch__body_T,\n\t\tpassword_realm__body_T,\n\t\tauth0__grant_type__body_T,\n\t\tauth0__oauth_token__fetch__body_T {}\nexport interface login_data_password_realm_body_I\n\textends auth0__login_data_T,\n\t\tauth0__client_id__body_T,\n\t\tauth0__passwordless_start__fetch__body_T,\n\t\tpassword_realm__body_T,\n\t\tauth0__grant_type__body_T,\n\t\tauth0__oauth_token__fetch__body_T {}\nexport interface onsubmit_change_password_Ctx {\n\tpassword_input:HTMLInputElement\n\tpassword_confirmation_input:HTMLInputElement\n}\nexport interface onsubmit_forgot_password_Ctx {\n\temail_input:HTMLInputElement\n}\nexport interface onsubmit_login_Ctx {\n\tusername_login_input:HTMLInputElement\n\tpassword_login_input:HTMLInputElement\n}\nexport interface onsubmit_signup_Ctx {\n\temail_input:HTMLInputElement\n\tpassword_input:HTMLInputElement\n\tpassword_confirmation_input:HTMLInputElement\n}\n"],"names":["auth0__body_","auth0__opened__class__","auth0__token__error__","auth0__token__json__","auth0__token__error__clear","auth0__close","auth0__token__error__logout","auth0__forgot_password__check_email__open","auth0__login__open","password_realm__body_","auth0__change_password__fetch_post","auth0__dbconnections_signup__fetch_get","auth0__oauth_token__fetch_post","auth0__passwordless_start__fetch_post","auth0__change_password__validate","auth0__forgot_password__validate","auth0__signup__validate","dom_a_","has_dom","noop","onDestroy","Auth0_c","constructor","ctx","login_auth0_body_","data","login_password_realm_body_","signup_auth0_body_","signup_password_realm_body_","auth0_opened_class","auth0_token_json_","auth0_token_error_","onMount","root","unsubscribe","subscribe","schedule_forms_clear","login","auth0_token","response","ok","auth0_token_json","JSON","stringify","$","auth_token_error","signup","auth0_userinfo","auth0_userinfo_Auth0Error","statusCode","code","description","email","auth0_token_error","username","password","change_password","form","error","response_json","status","e","console","warn","message","schedule_forms_clear_","setTimeout","clear_inputs","onsubmit_signup","event","preventDefault","email_input","password_input","password_confirmation_input","value","password_confirmation","onsubmit_login","username_login_input","password_login_input","onsubmit_forgot_password","connection","send","onsubmit_change_password","onclose","inputs","i","length","input"],"mappings":"AAUA,SACCA,YAAY,EACZC,sBAAsB,E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,IAAI,GAAGA,IAAID,OAAOE,MAAM,EAAED,IAAK;QACvC,MAAME,QAAQH,MAAM,CAACC,EAAE;QACvBE,MAAMb,KAAK,GAAG;IACf;AACD"}
|
|
1
|
+
{"version":3,"sources":["../../src/ui/Auth0_c.ts"],"sourcesContent":["import type {\n\tauth0__client_id__body_T,\n\tauth0__grant_type__body_T,\n\tauth0__login_data_T,\n\tpassword_realm__body_T,\n\tauth0__oauth_token__fetch__body_T,\n\tauth0__passwordless_start__fetch__body_T,\n\tauth0__passwordless_start__fetch__optional_body_T,\n\tauth0__signup_data_T\n} from '@ctx-core/auth0'\nimport {\n\tauth0__body_,\n\tauth0__opened__class__,\n\tauth0__token__error__,\n\tauth0__token__json__,\n\tauth0__token__error__clear,\n\tauth0__close,\n\tauth0__token__error__logout,\n\tauth0__forgot_password__check_email__open,\n\tauth0__login__open,\n\tpassword_realm__body_,\n\tauth0__change_password__fetch_post,\n\tauth0__dbconnections_signup__fetch_get,\n\tauth0__oauth_token__fetch_post,\n\tauth0__passwordless_start__fetch_post,\n\tauth0__change_password__validate,\n\tauth0__forgot_password__validate,\n\tauth0__signup__validate\n} from '@ctx-core/auth0'\nimport { dom_a_, has_dom } from '@ctx-core/dom'\nimport { noop } from '@ctx-core/function'\nimport type { Ctx } from '@ctx-core/object'\nimport type { Auth0Error } from 'auth0-js'\nimport { onDestroy } from 'svelte'\nexport class Auth0_c {\n\tconstructor(protected ctx:Ctx) {}\n\treadonly auth0__login__body_ = (data:any)=>\n\t\tauth0__body_<login__password_realm__body_T>(\n\t\t\tthis.ctx, data\n\t\t)\n\treadonly auth0__login__password_realm__body_ = (data:any)=>\n\t\tpassword_realm__body_<login__password_realm__body_T>(\n\t\t\tthis.ctx,\n\t\t\tthis.auth0__login__body_(data)\n\t\t)\n\treadonly auth0__signup__body_ = (data:any)=>\n\t\tauth0__body_<signup__password_realm__body_T>(this.ctx, data) as signup__password_realm__body_T\n\treadonly auth0__signup__password_realm__body_ = (data:any)=>\n\t\tpassword_realm__body_<signup__password_realm__body_T>(this.ctx, this.auth0__signup__body_(data))\n\treadonly auth0__opened__class = auth0__opened__class__(this.ctx)\n\treadonly auth0__token__json_ = auth0__token__json__(this.ctx)\n\treadonly auth0__token__error_ = auth0__token__error__(this.ctx)\n\treadonly auth0__close = ()=>auth0__close(this.ctx)\n\treadonly onMount = async (root:HTMLElement)=>{\n\t\tif (has_dom) {\n\t\t\tconst unsubscribe =\n\t\t\t\tthis.auth0__opened__class.subscribe(()=>this.forms__clear__schedule(root))\n\t\t\tonDestroy(unsubscribe)\n\t\t}\n\t}\n\treadonly login = async (data:auth0__login_data_T, forms__clear__schedule = ()=>{})=>{\n\t\tconst [auth0_token, response] = await auth0__oauth_token__fetch_post(\n\t\t\tthis.ctx, this.auth0__login__password_realm__body_(data)\n\t\t)\n\t\tif (response.ok) {\n\t\t\tconst auth0_token_json = JSON.stringify(auth0_token)\n\t\t\tthis.auth0__token__json_.$ = auth0_token_json\n\t\t\tforms__clear__schedule()\n\t\t\tthis.auth0__close()\n\t\t} else {\n\t\t\tconst auth_token_error = auth0_token as Auth0Error\n\t\t\tthis.auth0__token__error_.$ = auth_token_error\n\t\t\tauth0__token__error__logout(this.ctx, auth_token_error)\n\t\t}\n\t}\n\treadonly signup = async (data:auth0__signup_data_T, forms__clear__schedule = ()=>{})=>{\n\t\tconst [auth0_userinfo] = await auth0__dbconnections_signup__fetch_get(\n\t\t\tthis.ctx,\n\t\t\tthis.auth0__signup__password_realm__body_(data))\n\t\tconst auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error\n\t\tconst { statusCode } = auth0_userinfo_Auth0Error\n\t\tif (statusCode) {\n\t\t\tconst {\n\t\t\t\tcode,\n\t\t\t\tdescription\n\t\t\t} = auth0_userinfo_Auth0Error\n\t\t\tconst email =\n\t\t\t\tcode === 'user_exists'\n\t\t\t\t? 'This Email is already signed up'\n\t\t\t\t: description || ''\n\t\t\tconst auth0_token_error = { email }\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tforms__clear__schedule()\n\t\tawait this.login({\n\t\t\tusername: data.email,\n\t\t\tpassword: data.password,\n\t\t}, forms__clear__schedule)\n\t}\n\treadonly change_password = async (form:{ password:string }, forms__clear__schedule = ()=>{})=>{\n\t\tconst { password } = form\n\t\tlet error\n\t\ttry {\n\t\t\tconst [response_json, response] = await auth0__change_password__fetch_post(this.ctx, password)\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status == 401) {\n\t\t\t\t\tauth0__login__open(this.ctx)\n\t\t\t\t\tconst auth0_token_error = { username: 'Authentication Error - Log in' }\n\t\t\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terror = response_json.error || 'Error changing Password'\n\t\t\t}\n\t\t} catch (e:any) {\n\t\t\tconsole.warn(e)\n\t\t\terror = e.message\n\t\t}\n\t\tif (error) {\n\t\t\tconst auth0_token_error = { password: error }\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tforms__clear__schedule()\n\t\tthis.auth0__close()\n\t}\n\treadonly forms__clear__schedule_:(root:HTMLElement)=>void = (root:HTMLElement)=>{\n\t\treturn ()=>this.forms__clear__schedule(root)\n\t}\n\treadonly forms__clear__schedule = (root:HTMLElement)=>{\n\t\tsetTimeout(()=>{\n\t\t\tauth0__token__error__clear(this.ctx)\n\t\t\tinputs__clear(dom_a_('input[type=text]', root))\n\t\t\tinputs__clear(dom_a_('input[type=password]', root))\n\t\t}, 100)\n\t}\n\treadonly signup__onsubmit = async (event:Event, ctx:signup__onsubmit__o_T, forms__clear__schedule = ()=>{})=>{\n\t\tevent.preventDefault()\n\t\tconst {\n\t\t\temail_input,\n\t\t\tpassword_input,\n\t\t\tpassword_confirmation_input,\n\t\t} = ctx\n\t\tconst email = email_input.value\n\t\tconst password = password_input.value\n\t\tconst password_confirmation = password_confirmation_input.value\n\t\tconst auth0_token_error =\n\t\t\tauth0__signup__validate({\n\t\t\t\temail,\n\t\t\t\tpassword,\n\t\t\t\tpassword_confirmation\n\t\t\t})\n\t\tif (auth0_token_error) {\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\treturn false\n\t\t}\n\t\tawait this.signup({\n\t\t\temail,\n\t\t\tpassword\n\t\t}, forms__clear__schedule)\n\t\treturn\n\t}\n\treadonly login__onsubmit = async (event:Event, ctx:login__onsubmit__o_T, forms__clear__schedule = ()=>{})=>{\n\t\tevent.preventDefault()\n\t\tconst { username_login_input, password_login_input } = ctx\n\t\tconst username = username_login_input.value\n\t\tconst password = password_login_input.value\n\t\tawait this.login({ username, password }, forms__clear__schedule)\n\t}\n\treadonly forgot_password__onsubmit = async (event:Event, ctx:forgot_password__onsubmit__o_T)=>{\n\t\tevent.preventDefault()\n\t\tconst { email_input } = ctx\n\t\tconst email = email_input.value\n\t\tconst data:auth0__passwordless_start__fetch__optional_body_T = {\n\t\t\tconnection: 'email',\n\t\t\tsend: 'link',\n\t\t\temail\n\t\t}\n\t\tconst auth0_token_error = auth0__forgot_password__validate(data)\n\t\tif (auth0_token_error) {\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tawait auth0__passwordless_start__fetch_post(\n\t\t\tthis.ctx, this.auth0__login__body_(data) as auth0__passwordless_start__fetch__body_T\n\t\t)\n\t\tauth0__forgot_password__check_email__open(this.ctx)\n\t}\n\treadonly change_password__onsubmit = async (\n\t\tevent:Event, ctx:change_password__onsubmit__o_T, forms__clear__schedule = noop\n\t)=>{\n\t\tevent.preventDefault()\n\t\tconst {\n\t\t\tpassword_input,\n\t\t\tpassword_confirmation_input,\n\t\t} = ctx\n\t\tconst password = password_input.value\n\t\tconst password_confirmation = password_confirmation_input.value\n\t\tconst auth0_token_error =\n\t\t\tauth0__change_password__validate(\n\t\t\t\t{\n\t\t\t\t\tpassword,\n\t\t\t\t\tpassword_confirmation\n\t\t\t\t})\n\t\tif (auth0_token_error) {\n\t\t\tauth0__token__error__logout(this.ctx, auth0_token_error)\n\t\t\tthrow auth0_token_error\n\t\t}\n\t\treturn await this.change_password({ password }, forms__clear__schedule)\n\t}\n\treadonly onclose = async (event:MouseEvent)=>{\n\t\tevent.preventDefault()\n\t\tthis.auth0__close()\n\t}\n}\nfunction inputs__clear(inputs:NodeList) {\n\tfor (let i = 0; i < inputs.length; i++) {\n\t\tconst input = inputs[i] as HTMLInputElement\n\t\tinput.value = ''\n\t}\n}\nexport interface signup__password_realm__body_T\n\textends auth0__signup_data_T,\n\t\tauth0__client_id__body_T,\n\t\tauth0__passwordless_start__fetch__body_T,\n\t\tpassword_realm__body_T,\n\t\tauth0__grant_type__body_T,\n\t\tauth0__oauth_token__fetch__body_T {}\nexport interface login__password_realm__body_T\n\textends auth0__login_data_T,\n\t\tauth0__client_id__body_T,\n\t\tauth0__passwordless_start__fetch__body_T,\n\t\tpassword_realm__body_T,\n\t\tauth0__grant_type__body_T,\n\t\tauth0__oauth_token__fetch__body_T {}\nexport interface change_password__onsubmit__o_T {\n\tpassword_input:HTMLInputElement\n\tpassword_confirmation_input:HTMLInputElement\n}\nexport interface forgot_password__onsubmit__o_T {\n\temail_input:HTMLInputElement\n}\nexport interface login__onsubmit__o_T {\n\tusername_login_input:HTMLInputElement\n\tpassword_login_input:HTMLInputElement\n}\nexport interface signup__onsubmit__o_T {\n\temail_input:HTMLInputElement\n\tpassword_input:HTMLInputElement\n\tpassword_confirmation_input:HTMLInputElement\n}\n"],"names":["auth0__body_","auth0__opened__class__","auth0__token__error__","auth0__token__json__","auth0__token__error__clear","auth0__close","auth0__token__error__logout","auth0__forgot_password__check_email__open","auth0__login__open","password_realm__body_","auth0__change_password__fetch_post","auth0__dbconnections_signup__fetch_get","auth0__oauth_token__fetch_post","auth0__passwordless_start__fetch_post","auth0__change_password__validate","auth0__forgot_password__validate","auth0__signup__validate","dom_a_","has_dom","noop","onDestroy","Auth0_c","constructor","ctx","auth0__login__body_","data","auth0__login__password_realm__body_","auth0__signup__body_","auth0__signup__password_realm__body_","auth0__opened__class","auth0__token__json_","auth0__token__error_","onMount","root","unsubscribe","subscribe","forms__clear__schedule","login","auth0_token","response","ok","auth0_token_json","JSON","stringify","$","auth_token_error","signup","auth0_userinfo","auth0_userinfo_Auth0Error","statusCode","code","description","email","auth0_token_error","username","password","change_password","form","error","response_json","status","e","console","warn","message","forms__clear__schedule_","setTimeout","inputs__clear","signup__onsubmit","event","preventDefault","email_input","password_input","password_confirmation_input","value","password_confirmation","login__onsubmit","username_login_input","password_login_input","forgot_password__onsubmit","connection","send","change_password__onsubmit","onclose","inputs","i","length","input"],"mappings":"AAUA,SACCA,YAAY,EACZC,sBAAsB,EACtBC,qBAAqB,EACrBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,YAAY,EACZC,2BAA2B,EAC3BC,yCAAyC,EACzCC,kBAAkB,EAClBC,qBAAqB,EACrBC,kCAAkC,EAClCC,sCAAsC,EACtCC,8BAA8B,EAC9BC,qCAAqC,EACrCC,gCAAgC,EAChCC,gCAAgC,EAChCC,uBAAuB,QACjB,kBAAiB;AACxB,SAASC,MAAM,EAAEC,OAAO,QAAQ,gBAAe;AAC/C,SAASC,IAAI,QAAQ,qBAAoB;AAGzC,SAASC,SAAS,QAAQ,SAAQ;AAClC,OAAO,MAAMC;IACZC,YAAsBC,IAAS;mBAATA;aACbC,sBAAsB,CAACC,OAC/BzB,aACC,IAAI,CAACuB,GAAG,EAAEE;aAEHC,sCAAsC,CAACD,OAC/ChB,sBACC,IAAI,CAACc,GAAG,EACR,IAAI,CAACC,mBAAmB,CAACC;aAElBE,uBAAuB,CAACF,OAChCzB,aAA6C,IAAI,CAACuB,GAAG,EAAEE;aAC/CG,uCAAuC,CAACH,OAChDhB,sBAAsD,IAAI,CAACc,GAAG,EAAE,IAAI,CAACI,oBAAoB,CAACF;aAClFI,uBAAuB5B,uBAAuB,IAAI,CAACsB,GAAG;aACtDO,sBAAsB3B,qB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AC3B,GAAGlD;YACJ,MAAMgC,WAAWiB,eAAeE,KAAK;YACrC,MAAMC,wBAAwBF,4BAA4BC,KAAK;YAC/D,MAAMrB,oBACLvC,iCACC;gBACCyC;gBACAoB;YACD;YACF,IAAItB,mBAAmB;gBACtB/C,4BAA4B,IAAI,CAACiB,GAAG,EAAE8B;gBACtC,MAAMA,kBAAiB;YACxB,CAAC;YACD,OAAO,MAAM,IAAI,CAACG,eAAe,CAAC;gBAAED;YAAS,GAAGnB;QACjD;aACS+C,UAAU,OAAOd,QAAmB;YAC5CA,MAAMC,cAAc;YACpB,IAAI,CAACjE,YAAY;QAClB;IAlLgC;AAmLjC,CAAC;AACD,SAAS8D,cAAciB,MAAe,EAAE;IACvC,IAAK,IAAIC,IAAI,GAAGA,IAAID,OAAOE,MAAM,EAAED,IAAK;QACvC,MAAME,QAAQH,MAAM,CAACC,EAAE;QACvBE,MAAMb,KAAK,GAAG;IACf;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/auth0-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "ctx-core auth0 ui component & express endpoints",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"./package.json": "./package.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ctx-core/auth0": "^35.1.
|
|
28
|
-
"@ctx-core/auth0-management": "^9.1.
|
|
27
|
+
"@ctx-core/auth0": "^35.1.7",
|
|
28
|
+
"@ctx-core/auth0-management": "^9.1.7",
|
|
29
29
|
"@ctx-core/dialog": "^20.1.35",
|
|
30
30
|
"@ctx-core/dialog-ui-svelte": "^1.0.46",
|
|
31
31
|
"@ctx-core/dom": "^11.2.33",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function auth0__script__html_():string {
|
|
2
2
|
return `
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
@@ -31,6 +31,7 @@ export function auth_script_html_():string {
|
|
|
31
31
|
`.trim()
|
|
32
32
|
}
|
|
33
33
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
auth0__script__html_ as auth_script_html_,
|
|
35
|
+
auth0__script__html_ as _auth_script_html,
|
|
36
|
+
auth0__script__html_ as _html__script__auth,
|
|
36
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const auth0__ui__o_key = Symbol('auth0__ui__o')
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './auth0__ui__o_key.js'
|
|
2
|
+
export * from './auth0__script__html_.js'
|
|
3
|
+
export * from './auth0__ui__o__getContext.js'
|
|
4
4
|
export * from './ui/index.js'
|
package/src/ui/Auth0.svelte
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
auth0__forgot_password__check_email__opened__, auth0__change_password__opened__
|
|
6
6
|
} from '@ctx-core/auth0'
|
|
7
7
|
import { ctx_ } from '@ctx-core/object'
|
|
8
|
-
import {
|
|
8
|
+
import { auth0__ui__o_key } from '../auth0__ui__o_key.js'
|
|
9
9
|
import { Auth0_c } from './Auth0_c.js'
|
|
10
10
|
import Auth0_Change_Password_Form from './Auth0_Change_Password_Form.svelte'
|
|
11
11
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
@@ -14,7 +14,7 @@ import Auth0_Forgot_Password_Form from './Auth0_Forgot_Password_Form.svelte'
|
|
|
14
14
|
import Auth0_Login_Form from './Auth0_Login_Form.svelte'
|
|
15
15
|
import Auth0_Signup_Form from './Auth0_Signup_Form.svelte'
|
|
16
16
|
export let ctx = ctx_(), dialog = false
|
|
17
|
-
setContext(
|
|
17
|
+
setContext(auth0__ui__o_key, ctx)
|
|
18
18
|
const auth0_change_password_opened_ = auth0__change_password__opened__(ctx)
|
|
19
19
|
const auth0_opened_class_ = auth0__opened__class__(ctx)
|
|
20
20
|
const auth0_forgot_password_check_email_opened_ = auth0__forgot_password__check_email__opened__(ctx)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher } from 'svelte'
|
|
3
3
|
import { AUTH0_DOMAIN__, auth0__token__error__ } from '@ctx-core/auth0'
|
|
4
|
-
import {
|
|
4
|
+
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
5
5
|
import { Auth0_c } from './Auth0_c.js'
|
|
6
6
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
7
|
-
const ctx =
|
|
7
|
+
const ctx = auth0__ui__o__getContext()
|
|
8
8
|
const dispatch = createEventDispatcher()
|
|
9
9
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
10
10
|
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
-
const
|
|
11
|
+
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root:HTMLDivElement
|
|
14
14
|
let password_input:HTMLInputElement
|
|
@@ -17,13 +17,13 @@ let password_error:any|undefined //region
|
|
|
17
17
|
$: password_error = $auth0_token_error_?.password //endregion
|
|
18
18
|
let password_error_confirmation:string|undefined //region
|
|
19
19
|
$: password_error_confirmation = $auth0_token_error_?.password_confirmation //endregion
|
|
20
|
-
async function
|
|
20
|
+
async function change_password__onsubmit(event:FormDataEvent) {
|
|
21
21
|
dispatch('submit__start')
|
|
22
22
|
try {
|
|
23
|
-
await _.
|
|
23
|
+
await _.change_password__onsubmit(event, {
|
|
24
24
|
password_input,
|
|
25
25
|
password_confirmation_input,
|
|
26
|
-
}, ()=>_.
|
|
26
|
+
}, ()=>_.forms__clear__schedule(root))
|
|
27
27
|
dispatch('success')
|
|
28
28
|
} catch (error) {
|
|
29
29
|
dispatch('error', { error })
|
|
@@ -41,7 +41,7 @@ async function onsubmit_change_password(event:FormDataEvent) {
|
|
|
41
41
|
action="https://{$AUTH0_DOMAIN_}/dbconnections/change_password"
|
|
42
42
|
accept-charset="UTF-8"
|
|
43
43
|
method="post"
|
|
44
|
-
on:submit|preventDefault={
|
|
44
|
+
on:submit|preventDefault={change_password__onsubmit}
|
|
45
45
|
>
|
|
46
46
|
{#if $auth0_token_error_}
|
|
47
47
|
<ul>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { CloseDialogHandle } from '@ctx-core/dialog-ui-svelte'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
4
4
|
import { Auth0_c } from './Auth0_c.js'
|
|
5
|
-
const ctx =
|
|
5
|
+
const ctx = auth0__ui__o__getContext()
|
|
6
6
|
const _ = new Auth0_c(ctx)
|
|
7
7
|
</script>
|
|
8
8
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { AUTH0_DOMAIN__, auth0__token__error__, auth0__login__open, auth0__signup__open } from '@ctx-core/auth0'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
4
4
|
import { Auth0_c } from './Auth0_c.js'
|
|
5
5
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
6
6
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
7
|
-
const ctx =
|
|
7
|
+
const ctx = auth0__ui__o__getContext()
|
|
8
8
|
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
9
|
-
const
|
|
9
|
+
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
10
10
|
const _ = new Auth0_c(ctx)
|
|
11
11
|
let email_input:HTMLInputElement, error:typeof $auth0_token_error_?.error
|
|
12
12
|
$: error = $auth0_token_error_?.error
|
|
@@ -19,7 +19,7 @@ $: error = $auth0_token_error_?.error
|
|
|
19
19
|
action="https://{$AUTH0_DOMAIN_}/passwordless/start"
|
|
20
20
|
accept-charset="UTF-8"
|
|
21
21
|
method="post"
|
|
22
|
-
on:submit={event => _.
|
|
22
|
+
on:submit={event => _.forgot_password__onsubmit(event, { email_input })}
|
|
23
23
|
>
|
|
24
24
|
{#if $auth0_token_error_}
|
|
25
25
|
<ul>
|
|
@@ -6,7 +6,7 @@ import { type Ctx } from '@ctx-core/object'
|
|
|
6
6
|
import { Auth0_c } from './Auth0_c.js'
|
|
7
7
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
8
|
export let ctx:Ctx, error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
|
-
const
|
|
9
|
+
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
10
10
|
const auth0_token_error_txt_ = auth0__token__error_txt__(ctx)
|
|
11
11
|
const AUTH0_DOMAIN = AUTH0_DOMAIN__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
@@ -26,10 +26,10 @@ $: error_password = $auth0_token_error_?.password //endregion
|
|
|
26
26
|
accept-charset="UTF-8"
|
|
27
27
|
method="post"
|
|
28
28
|
on:submit={event =>
|
|
29
|
-
_.
|
|
29
|
+
_.login__onsubmit(event, {
|
|
30
30
|
username_login_input,
|
|
31
31
|
password_login_input
|
|
32
|
-
}, ()=>_.
|
|
32
|
+
}, ()=>_.forms__clear__schedule(root))}
|
|
33
33
|
>
|
|
34
34
|
{#if $auth0_token_error_txt_}
|
|
35
35
|
<ul>
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AUTH0_DOMAIN__, auth0__token__error__, auth0__forgot_password__open, auth0__login__open,
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
|
-
import {
|
|
5
|
+
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
6
6
|
import { Auth0_c } from './Auth0_c.js'
|
|
7
7
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
8
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
|
-
const ctx =
|
|
9
|
+
const ctx = auth0__ui__o__getContext()
|
|
10
10
|
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
-
const
|
|
11
|
+
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root, signup_email_input, signup_password_input, signup_password_confirmation_input
|
|
14
14
|
let error_username:string|undefined //region
|
|
@@ -37,11 +37,11 @@ $: {
|
|
|
37
37
|
accept-charset="UTF-8"
|
|
38
38
|
method="post"
|
|
39
39
|
on:submit={event =>
|
|
40
|
-
_.
|
|
40
|
+
_.signup__onsubmit(event, {
|
|
41
41
|
signup_email_input,
|
|
42
42
|
signup_password_input,
|
|
43
43
|
signup_password_confirmation_input
|
|
44
|
-
}, _.
|
|
44
|
+
}, _.forms__clear__schedule(root))
|
|
45
45
|
}
|
|
46
46
|
>
|
|
47
47
|
{#if $auth0_token_error_}
|
package/src/ui/Auth0_c.ts
CHANGED
|
@@ -34,49 +34,49 @@ import type { Auth0Error } from 'auth0-js'
|
|
|
34
34
|
import { onDestroy } from 'svelte'
|
|
35
35
|
export class Auth0_c {
|
|
36
36
|
constructor(protected ctx:Ctx) {}
|
|
37
|
-
readonly
|
|
38
|
-
auth0__body_<
|
|
37
|
+
readonly auth0__login__body_ = (data:any)=>
|
|
38
|
+
auth0__body_<login__password_realm__body_T>(
|
|
39
39
|
this.ctx, data
|
|
40
40
|
)
|
|
41
|
-
readonly
|
|
42
|
-
password_realm__body_<
|
|
41
|
+
readonly auth0__login__password_realm__body_ = (data:any)=>
|
|
42
|
+
password_realm__body_<login__password_realm__body_T>(
|
|
43
43
|
this.ctx,
|
|
44
|
-
this.
|
|
44
|
+
this.auth0__login__body_(data)
|
|
45
45
|
)
|
|
46
|
-
readonly
|
|
47
|
-
auth0__body_<
|
|
48
|
-
readonly
|
|
49
|
-
password_realm__body_<
|
|
50
|
-
readonly
|
|
51
|
-
readonly
|
|
52
|
-
readonly
|
|
46
|
+
readonly auth0__signup__body_ = (data:any)=>
|
|
47
|
+
auth0__body_<signup__password_realm__body_T>(this.ctx, data) as signup__password_realm__body_T
|
|
48
|
+
readonly auth0__signup__password_realm__body_ = (data:any)=>
|
|
49
|
+
password_realm__body_<signup__password_realm__body_T>(this.ctx, this.auth0__signup__body_(data))
|
|
50
|
+
readonly auth0__opened__class = auth0__opened__class__(this.ctx)
|
|
51
|
+
readonly auth0__token__json_ = auth0__token__json__(this.ctx)
|
|
52
|
+
readonly auth0__token__error_ = auth0__token__error__(this.ctx)
|
|
53
53
|
readonly auth0__close = ()=>auth0__close(this.ctx)
|
|
54
54
|
readonly onMount = async (root:HTMLElement)=>{
|
|
55
55
|
if (has_dom) {
|
|
56
56
|
const unsubscribe =
|
|
57
|
-
this.
|
|
57
|
+
this.auth0__opened__class.subscribe(()=>this.forms__clear__schedule(root))
|
|
58
58
|
onDestroy(unsubscribe)
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
readonly login = async (data:auth0__login_data_T,
|
|
61
|
+
readonly login = async (data:auth0__login_data_T, forms__clear__schedule = ()=>{})=>{
|
|
62
62
|
const [auth0_token, response] = await auth0__oauth_token__fetch_post(
|
|
63
|
-
this.ctx, this.
|
|
63
|
+
this.ctx, this.auth0__login__password_realm__body_(data)
|
|
64
64
|
)
|
|
65
65
|
if (response.ok) {
|
|
66
66
|
const auth0_token_json = JSON.stringify(auth0_token)
|
|
67
|
-
this.
|
|
68
|
-
|
|
67
|
+
this.auth0__token__json_.$ = auth0_token_json
|
|
68
|
+
forms__clear__schedule()
|
|
69
69
|
this.auth0__close()
|
|
70
70
|
} else {
|
|
71
71
|
const auth_token_error = auth0_token as Auth0Error
|
|
72
|
-
this.
|
|
72
|
+
this.auth0__token__error_.$ = auth_token_error
|
|
73
73
|
auth0__token__error__logout(this.ctx, auth_token_error)
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
readonly signup = async (data:auth0__signup_data_T,
|
|
76
|
+
readonly signup = async (data:auth0__signup_data_T, forms__clear__schedule = ()=>{})=>{
|
|
77
77
|
const [auth0_userinfo] = await auth0__dbconnections_signup__fetch_get(
|
|
78
78
|
this.ctx,
|
|
79
|
-
this.
|
|
79
|
+
this.auth0__signup__password_realm__body_(data))
|
|
80
80
|
const auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error
|
|
81
81
|
const { statusCode } = auth0_userinfo_Auth0Error
|
|
82
82
|
if (statusCode) {
|
|
@@ -92,13 +92,13 @@ export class Auth0_c {
|
|
|
92
92
|
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
93
93
|
return
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
forms__clear__schedule()
|
|
96
96
|
await this.login({
|
|
97
97
|
username: data.email,
|
|
98
98
|
password: data.password,
|
|
99
|
-
},
|
|
99
|
+
}, forms__clear__schedule)
|
|
100
100
|
}
|
|
101
|
-
readonly change_password = async (form:{ password:string },
|
|
101
|
+
readonly change_password = async (form:{ password:string }, forms__clear__schedule = ()=>{})=>{
|
|
102
102
|
const { password } = form
|
|
103
103
|
let error
|
|
104
104
|
try {
|
|
@@ -121,20 +121,20 @@ export class Auth0_c {
|
|
|
121
121
|
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
122
122
|
return
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
forms__clear__schedule()
|
|
125
125
|
this.auth0__close()
|
|
126
126
|
}
|
|
127
|
-
readonly
|
|
128
|
-
return ()=>this.
|
|
127
|
+
readonly forms__clear__schedule_:(root:HTMLElement)=>void = (root:HTMLElement)=>{
|
|
128
|
+
return ()=>this.forms__clear__schedule(root)
|
|
129
129
|
}
|
|
130
|
-
readonly
|
|
130
|
+
readonly forms__clear__schedule = (root:HTMLElement)=>{
|
|
131
131
|
setTimeout(()=>{
|
|
132
132
|
auth0__token__error__clear(this.ctx)
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
inputs__clear(dom_a_('input[type=text]', root))
|
|
134
|
+
inputs__clear(dom_a_('input[type=password]', root))
|
|
135
135
|
}, 100)
|
|
136
136
|
}
|
|
137
|
-
readonly
|
|
137
|
+
readonly signup__onsubmit = async (event:Event, ctx:signup__onsubmit__o_T, forms__clear__schedule = ()=>{})=>{
|
|
138
138
|
event.preventDefault()
|
|
139
139
|
const {
|
|
140
140
|
email_input,
|
|
@@ -157,17 +157,17 @@ export class Auth0_c {
|
|
|
157
157
|
await this.signup({
|
|
158
158
|
email,
|
|
159
159
|
password
|
|
160
|
-
},
|
|
160
|
+
}, forms__clear__schedule)
|
|
161
161
|
return
|
|
162
162
|
}
|
|
163
|
-
readonly
|
|
163
|
+
readonly login__onsubmit = async (event:Event, ctx:login__onsubmit__o_T, forms__clear__schedule = ()=>{})=>{
|
|
164
164
|
event.preventDefault()
|
|
165
165
|
const { username_login_input, password_login_input } = ctx
|
|
166
166
|
const username = username_login_input.value
|
|
167
167
|
const password = password_login_input.value
|
|
168
|
-
await this.login({ username, password },
|
|
168
|
+
await this.login({ username, password }, forms__clear__schedule)
|
|
169
169
|
}
|
|
170
|
-
readonly
|
|
170
|
+
readonly forgot_password__onsubmit = async (event:Event, ctx:forgot_password__onsubmit__o_T)=>{
|
|
171
171
|
event.preventDefault()
|
|
172
172
|
const { email_input } = ctx
|
|
173
173
|
const email = email_input.value
|
|
@@ -182,12 +182,12 @@ export class Auth0_c {
|
|
|
182
182
|
return
|
|
183
183
|
}
|
|
184
184
|
await auth0__passwordless_start__fetch_post(
|
|
185
|
-
this.ctx, this.
|
|
185
|
+
this.ctx, this.auth0__login__body_(data) as auth0__passwordless_start__fetch__body_T
|
|
186
186
|
)
|
|
187
187
|
auth0__forgot_password__check_email__open(this.ctx)
|
|
188
188
|
}
|
|
189
|
-
readonly
|
|
190
|
-
event:Event, ctx:
|
|
189
|
+
readonly change_password__onsubmit = async (
|
|
190
|
+
event:Event, ctx:change_password__onsubmit__o_T, forms__clear__schedule = noop
|
|
191
191
|
)=>{
|
|
192
192
|
event.preventDefault()
|
|
193
193
|
const {
|
|
@@ -206,45 +206,45 @@ export class Auth0_c {
|
|
|
206
206
|
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
207
207
|
throw auth0_token_error
|
|
208
208
|
}
|
|
209
|
-
return await this.change_password({ password },
|
|
209
|
+
return await this.change_password({ password }, forms__clear__schedule)
|
|
210
210
|
}
|
|
211
211
|
readonly onclose = async (event:MouseEvent)=>{
|
|
212
212
|
event.preventDefault()
|
|
213
213
|
this.auth0__close()
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function inputs__clear(inputs:NodeList) {
|
|
217
217
|
for (let i = 0; i < inputs.length; i++) {
|
|
218
218
|
const input = inputs[i] as HTMLInputElement
|
|
219
219
|
input.value = ''
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
export interface
|
|
222
|
+
export interface signup__password_realm__body_T
|
|
223
223
|
extends auth0__signup_data_T,
|
|
224
224
|
auth0__client_id__body_T,
|
|
225
225
|
auth0__passwordless_start__fetch__body_T,
|
|
226
226
|
password_realm__body_T,
|
|
227
227
|
auth0__grant_type__body_T,
|
|
228
228
|
auth0__oauth_token__fetch__body_T {}
|
|
229
|
-
export interface
|
|
229
|
+
export interface login__password_realm__body_T
|
|
230
230
|
extends auth0__login_data_T,
|
|
231
231
|
auth0__client_id__body_T,
|
|
232
232
|
auth0__passwordless_start__fetch__body_T,
|
|
233
233
|
password_realm__body_T,
|
|
234
234
|
auth0__grant_type__body_T,
|
|
235
235
|
auth0__oauth_token__fetch__body_T {}
|
|
236
|
-
export interface
|
|
236
|
+
export interface change_password__onsubmit__o_T {
|
|
237
237
|
password_input:HTMLInputElement
|
|
238
238
|
password_confirmation_input:HTMLInputElement
|
|
239
239
|
}
|
|
240
|
-
export interface
|
|
240
|
+
export interface forgot_password__onsubmit__o_T {
|
|
241
241
|
email_input:HTMLInputElement
|
|
242
242
|
}
|
|
243
|
-
export interface
|
|
243
|
+
export interface login__onsubmit__o_T {
|
|
244
244
|
username_login_input:HTMLInputElement
|
|
245
245
|
password_login_input:HTMLInputElement
|
|
246
246
|
}
|
|
247
|
-
export interface
|
|
247
|
+
export interface signup__onsubmit__o_T {
|
|
248
248
|
email_input:HTMLInputElement
|
|
249
249
|
password_input:HTMLInputElement
|
|
250
250
|
password_confirmation_input:HTMLInputElement
|
package/COMMIT_EDITMSG
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/lib/auth0_ui_ctx_key.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/auth0_ui_ctx_key.ts"],"sourcesContent":["export const auth0_ui_ctx_key = Symbol('auth0_ui_ctx')\n"],"names":["auth0_ui_ctx_key","Symbol"],"mappings":"AAAA,OAAO,MAAMA,mBAAmBC,OAAO,gBAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/auth_script_html_.ts"],"sourcesContent":["export function auth_script_html_():string {\n\treturn `\n<script>\n\t(function() {\n\t\tvar location = window.location\n\t\tvar search = location.search\n\t\tvar search_values = _values(search.substr(1))\n\t\tvar hash = location.hash\n\t\tvar auth0_token = _values(hash.substr(1))\n\t\tvar auth0_token_json = JSON.stringify(auth0_token)\n\t\tvar redirect_url =\n\t\t\t\t\tsearch_values\n\t\t\t\t\t&& search_values.redirect_url\n\t\tlocalStorage.setItem('auth0_token_json', auth0_token_json)\n\t\tif (redirect_url) {\n\t\t\tlocation.href = redirect_url\n\t\t}\n\t\tfunction _values(string) {\n\t\t\tvar segments = string.split('&')\n\t\t\tvar values = {}\n\t\t\tfor (var i=0; i < segments.length; i++) {\n\t\t\t\tvar pair = segments[i].split('=')\n\t\t\t\tvar key = decodeURIComponent(pair[0])\n\t\t\t\tvar value = decodeURIComponent(pair[1])\n\t\t\t\tvalues[key] = value\n\t\t\t}\n\t\t\treturn values\n\t\t}\n\t})()\n</script>\n\t`.trim()\n}\nexport {\n\tauth_script_html_ as _auth_script_html,\n\tauth_script_html_ as _html__script__auth,\n}\n"],"names":["auth_script_html_","trim","_auth_script_html","_html__script__auth"],"mappings":"AAAA,OAAO,SAASA,oBAA2B;IAC1C,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BR,CAAC,CAACC,IAAI;AACP,CAAC;AACD,SACCD,qBAAqBE,iBAAiB,EACtCF,qBAAqBG,mBAAmB,KACxC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/getContext_auth0_ui_ctx.ts"],"sourcesContent":["import { getContext } from 'svelte'\nimport type { Ctx } from '@ctx-core/object'\nimport { auth0_ui_ctx_key } from './auth0_ui_ctx_key.js'\nexport function getContext_auth0_ui_ctx() {\n return getContext(auth0_ui_ctx_key) as Ctx\n}\n"],"names":["getContext","auth0_ui_ctx_key","getContext_auth0_ui_ctx"],"mappings":"AAAA,SAASA,UAAU,QAAQ,SAAQ;AAEnC,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,OAAO,SAASC,0BAA0B;IACxC,OAAOF,WAAWC;AACpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const auth0_ui_ctx_key: unique symbol;
|
package/src/auth0_ui_ctx_key.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const auth0_ui_ctx_key = Symbol('auth0_ui_ctx')
|