@ctx-core/auth0-ui 12.2.5 → 12.2.9
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 +34 -0
- package/lib/src/ui/Auth0_c.d.ts +6 -13
- package/lib/ui/Auth0.svelte +15 -15
- package/lib/ui/Auth0_Change_Password_Form.svelte +3 -3
- package/lib/ui/Auth0_Forgot_Password_Form.svelte +7 -9
- package/lib/ui/Auth0_Login_Form.svelte +8 -10
- package/lib/ui/Auth0_Signup_Form.svelte +7 -9
- package/lib/ui/Auth0_c.js +28 -30
- package/lib/ui/Auth0_c.js.map +1 -1
- package/package.json +11 -11
- package/src/ui/Auth0.svelte +15 -15
- package/src/ui/Auth0_Change_Password_Form.svelte +3 -3
- package/src/ui/Auth0_Forgot_Password_Form.svelte +7 -9
- package/src/ui/Auth0_Login_Form.svelte +8 -10
- package/src/ui/Auth0_Signup_Form.svelte +7 -9
- package/src/ui/Auth0_c.ts +40 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @ctx-core/auth0-ui
|
|
2
2
|
|
|
3
|
+
## 12.2.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @ctx-core/auth0@30.0.0
|
|
9
|
+
- @ctx-core/auth0-management@9.0.0
|
|
10
|
+
- @ctx-core/dialog@19.0.0
|
|
11
|
+
- @ctx-core/fetch-undici@1.1.1
|
|
12
|
+
|
|
13
|
+
## 12.2.8
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- update dependencies
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @ctx-core/auth0-management@8.0.4
|
|
20
|
+
|
|
21
|
+
## 12.2.7
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- update dependencies
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @ctx-core/auth0-management@8.0.3
|
|
28
|
+
|
|
29
|
+
## 12.2.6
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- auth0-js: ^9.18.1 -> ^9.19.0
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
- @ctx-core/auth0@29.0.2
|
|
36
|
+
|
|
3
37
|
## 12.2.5
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/lib/src/ui/Auth0_c.d.ts
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { auth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, password_realm_body_T, post_auth0_oauth_token_body_I, post_auth0_passwordless_start_body_T, signup_data_I } from '@ctx-core/auth0';
|
|
2
2
|
import { noop } from '@ctx-core/function';
|
|
3
3
|
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 login_auth0_body_:
|
|
8
|
-
readonly login_password_realm_body_:
|
|
9
|
-
readonly signup_auth0_body_:
|
|
10
|
-
readonly signup_password_realm_body_:
|
|
7
|
+
readonly login_auth0_body_: (data: any) => login_data_password_realm_body_I;
|
|
8
|
+
readonly login_password_realm_body_: (data: any) => login_data_password_realm_body_I;
|
|
9
|
+
readonly signup_auth0_body_: (data: any) => signup_data_password_realm_body_I;
|
|
10
|
+
readonly signup_password_realm_body_: (data: any) => signup_data_password_realm_body_I;
|
|
11
11
|
readonly auth0_opened_class: import("@ctx-core/auth0").auth0_opened_class$_T;
|
|
12
12
|
readonly auth0_token_json$: import("@ctx-core/auth0").auth0_token_json$_T;
|
|
13
13
|
readonly auth0_token_error$: import("@ctx-core/auth0").auth0_token_error$_T;
|
|
14
14
|
readonly clear_auth0_token_error: import("@ctx-core/auth0").clear_auth0_token_error_T;
|
|
15
|
-
readonly close_auth0:
|
|
16
|
-
readonly logout_auth0_token_error: logout_auth0_token_error_T;
|
|
17
|
-
readonly open_auth0_login: open_auth0_login_T;
|
|
18
|
-
readonly open_auth0_forgot_password_check_email: open_auth0_forgot_password_check_email_T;
|
|
19
|
-
readonly post_auth0_dbconnections_signup: post_auth0_dbconnections_signup_T;
|
|
20
|
-
readonly post_auth0_oauth_token: post_auth0_oauth_token_T;
|
|
21
|
-
readonly post_auth0_auth_change_password: post_auth0_auth_change_password_T;
|
|
22
|
-
readonly post_auth0_passwordless_start: post_auth0_passwordless_start_T;
|
|
15
|
+
readonly close_auth0: () => void;
|
|
23
16
|
readonly onMount: (root: HTMLElement) => Promise<void>;
|
|
24
17
|
readonly login: (data: login_data_I, schedule_forms_clear?: () => void) => Promise<void>;
|
|
25
18
|
readonly signup: (data: signup_data_I, schedule_forms_clear?: () => void) => Promise<void>;
|
package/lib/ui/Auth0.svelte
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { setContext } from 'svelte'
|
|
3
3
|
import {
|
|
4
|
-
auth0_forgot_password_opened$
|
|
5
|
-
auth0_forgot_password_check_email_opened$
|
|
4
|
+
auth0_forgot_password_opened$_, auth0_opened_class$_, auth0_login_opened$_, auth0_signup_opened$_,
|
|
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
8
|
import { auth0_ui_ctx_key } from '../auth0_ui_ctx_key.js'
|
|
@@ -15,12 +15,12 @@ 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
17
|
setContext(auth0_ui_ctx_key, ctx)
|
|
18
|
-
const auth0_change_password_opened$ = auth0_change_password_opened$
|
|
19
|
-
const auth0_opened_class$ = auth0_opened_class$
|
|
20
|
-
const auth0_forgot_password_check_email_opened$ = auth0_forgot_password_check_email_opened$
|
|
21
|
-
const auth0_forgot_password_opened$ = auth0_forgot_password_opened$
|
|
22
|
-
const auth0_login_opened$ = auth0_login_opened$
|
|
23
|
-
const auth0_signup_opened$ = auth0_signup_opened$
|
|
18
|
+
const auth0_change_password_opened$ = auth0_change_password_opened$_(ctx)
|
|
19
|
+
const auth0_opened_class$ = auth0_opened_class$_(ctx)
|
|
20
|
+
const auth0_forgot_password_check_email_opened$ = auth0_forgot_password_check_email_opened$_(ctx)
|
|
21
|
+
const auth0_forgot_password_opened$ = auth0_forgot_password_opened$_(ctx)
|
|
22
|
+
const auth0_login_opened$ = auth0_login_opened$_(ctx)
|
|
23
|
+
const auth0_signup_opened$ = auth0_signup_opened$_(ctx)
|
|
24
24
|
const _ = new Auth0_c(ctx)
|
|
25
25
|
</script>
|
|
26
26
|
|
|
@@ -61,38 +61,38 @@ const _ = new Auth0_c(ctx)
|
|
|
61
61
|
font-size: 2rem;
|
|
62
62
|
text-align: center;
|
|
63
63
|
}
|
|
64
|
-
[name=
|
|
64
|
+
[name=auth_navigation] {
|
|
65
65
|
display: none;
|
|
66
66
|
~ .form {
|
|
67
67
|
display: none;
|
|
68
68
|
}
|
|
69
|
-
&.
|
|
69
|
+
&.auth_navigation-signup:checked {
|
|
70
70
|
~ .signup {
|
|
71
71
|
display: block;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
&.
|
|
74
|
+
&.auth_navigation-login:checked {
|
|
75
75
|
~ .login {
|
|
76
76
|
display: block;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
&.
|
|
79
|
+
&.auth_navigation-forgot_password:checked {
|
|
80
80
|
~ .forgot_password {
|
|
81
81
|
display: block;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
&.
|
|
84
|
+
&.auth_navigation-forgot_password_check_email:checked {
|
|
85
85
|
~ .forgot_password_check_email {
|
|
86
86
|
display: block;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
&.
|
|
89
|
+
&.auth_navigation-change_password:checked {
|
|
90
90
|
~ .change_password {
|
|
91
91
|
display: block;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
:global(label.
|
|
95
|
+
:global(label.auth_navigation) {
|
|
96
96
|
color: #3EBBC0;
|
|
97
97
|
font-weight: bold;
|
|
98
98
|
&:hover {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import { AUTH0_DOMAIN$
|
|
3
|
+
import { AUTH0_DOMAIN$_, auth0_token_error$_ } from '@ctx-core/auth0'
|
|
4
4
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.js'
|
|
5
5
|
import { Auth0_c } from './Auth0_c.js'
|
|
6
6
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
7
7
|
const ctx = getContext_auth0_ui_ctx()
|
|
8
8
|
const dispatch = createEventDispatcher()
|
|
9
9
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
10
|
-
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$
|
|
11
|
-
const auth0_token_error$ = auth0_token_error$
|
|
10
|
+
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_(ctx)
|
|
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
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { AUTH0_DOMAIN$
|
|
2
|
+
import { AUTH0_DOMAIN$_, auth0_token_error$_, open_auth0_login, open_auth0_signup } from '@ctx-core/auth0'
|
|
3
3
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.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
7
|
const ctx = getContext_auth0_ui_ctx()
|
|
8
|
-
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$
|
|
9
|
-
const auth0_token_error$ = auth0_token_error$
|
|
10
|
-
const open_auth0_login = open_auth0_login_b(ctx)
|
|
11
|
-
const open_auth0_signup = open_auth0_signup_b(ctx)
|
|
8
|
+
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_(ctx)
|
|
9
|
+
const auth0_token_error$ = auth0_token_error$_(ctx)
|
|
12
10
|
const _ = new Auth0_c(ctx)
|
|
13
11
|
let email_input:HTMLInputElement, error:string
|
|
14
12
|
$: error = $auth0_token_error$?.error
|
|
@@ -51,12 +49,12 @@ $: error = $auth0_token_error$?.error
|
|
|
51
49
|
class="button {button_class}"
|
|
52
50
|
/>
|
|
53
51
|
<label
|
|
54
|
-
class="
|
|
55
|
-
on:click={open_auth0_login}
|
|
52
|
+
class="auth_navigation {label_class}"
|
|
53
|
+
on:click={()=>open_auth0_login(ctx)}
|
|
56
54
|
>Have an account? Log in…</label>
|
|
57
55
|
<label
|
|
58
|
-
class="
|
|
59
|
-
on:click={open_auth0_signup}
|
|
56
|
+
class="auth_navigation {label_class}"
|
|
57
|
+
on:click={()=>open_auth0_signup(ctx)}
|
|
60
58
|
>Don't have an account? Signup…</label>
|
|
61
59
|
</footer>
|
|
62
60
|
</form>
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
AUTH0_DOMAIN$
|
|
3
|
+
AUTH0_DOMAIN$_, auth0_token_error$_, auth0_token_error_txt$_, open_auth0_forgot_password, open_auth0_signup
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
5
|
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 auth0_token_error$ = auth0_token_error$
|
|
10
|
-
const auth0_token_error_txt$ = auth0_token_error_txt$
|
|
11
|
-
const AUTH0_DOMAIN = AUTH0_DOMAIN$
|
|
12
|
-
const open_auth0_signup = open_auth0_signup_b(ctx)
|
|
13
|
-
const open_auth0_forgot_password = open_auth0_forgot_password_b(ctx)
|
|
9
|
+
const auth0_token_error$ = auth0_token_error$_(ctx)
|
|
10
|
+
const auth0_token_error_txt$ = auth0_token_error_txt$_(ctx)
|
|
11
|
+
const AUTH0_DOMAIN = AUTH0_DOMAIN$_(ctx)
|
|
14
12
|
const _ = new Auth0_c(ctx)
|
|
15
13
|
let root:HTMLDivElement
|
|
16
14
|
let username_login_input:HTMLInputElement, password_login_input:HTMLInputElement
|
|
@@ -73,12 +71,12 @@ $: error_password = $auth0_token_error$?.password //endregion
|
|
|
73
71
|
class="button {button_class}"
|
|
74
72
|
/>
|
|
75
73
|
<label
|
|
76
|
-
class="
|
|
77
|
-
on:click={open_auth0_signup}
|
|
74
|
+
class="auth_navigation {label_class}"
|
|
75
|
+
on:click={()=>open_auth0_signup(ctx)}
|
|
78
76
|
>Don't have an account? Signup…</label>
|
|
79
77
|
<label
|
|
80
|
-
class="
|
|
81
|
-
on:click={open_auth0_forgot_password}
|
|
78
|
+
class="auth_navigation {label_class}"
|
|
79
|
+
on:click={()=>open_auth0_forgot_password(ctx)}
|
|
82
80
|
>Forgot Password?</label>
|
|
83
81
|
</footer>
|
|
84
82
|
</form>
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
AUTH0_DOMAIN$
|
|
3
|
+
AUTH0_DOMAIN$_, auth0_token_error$_, open_auth0_forgot_password, open_auth0_login,
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
5
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.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
9
|
const ctx = getContext_auth0_ui_ctx()
|
|
10
|
-
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$
|
|
11
|
-
const auth0_token_error$ = auth0_token_error$
|
|
12
|
-
const open_auth0_login = open_auth0_login_b(ctx)
|
|
13
|
-
const open_auth0_forgot_password = open_auth0_forgot_password_b(ctx)
|
|
10
|
+
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_(ctx)
|
|
11
|
+
const auth0_token_error$ = auth0_token_error$_(ctx)
|
|
14
12
|
const _ = new Auth0_c(ctx)
|
|
15
13
|
let root, signup_email_input, signup_password_input, signup_password_confirmation_input
|
|
16
14
|
let error_username:string|undefined //region
|
|
@@ -107,12 +105,12 @@ $: {
|
|
|
107
105
|
class="button {button_class}"
|
|
108
106
|
/>
|
|
109
107
|
<label
|
|
110
|
-
class="
|
|
111
|
-
on:click={open_auth0_login}
|
|
108
|
+
class="auth_navigation {label_class}"
|
|
109
|
+
on:click={()=>open_auth0_login(ctx)}
|
|
112
110
|
>Have an account? Log in…</label>
|
|
113
111
|
<label
|
|
114
|
-
class="
|
|
115
|
-
on:click={open_auth0_forgot_password}
|
|
112
|
+
class="auth_navigation {label_class}"
|
|
113
|
+
on:click={()=>open_auth0_forgot_password(ctx)}
|
|
116
114
|
>Forgot Password?</label>
|
|
117
115
|
</footer>
|
|
118
116
|
</form>
|
package/lib/ui/Auth0_c.js
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { onDestroy } from 'svelte';
|
|
2
|
-
import {
|
|
2
|
+
import { auth0_body_, auth0_opened_class$_, auth0_token_error$_, auth0_token_json$_, clear_auth0_token_error_, close_auth0, logout_auth0_token_error, open_auth0_forgot_password_check_email, open_auth0_login, password_realm_body_, post_auth0_auth_change_password, post_auth0_dbconnections_signup, post_auth0_oauth_token, post_auth0_passwordless_start, validate_auth0_change_password, validate_auth0_forgot_password, validate_auth0_signup } from '@ctx-core/auth0';
|
|
3
3
|
import { has_dom, dom_a_ } from '@ctx-core/dom';
|
|
4
4
|
import { noop } from '@ctx-core/function';
|
|
5
5
|
export class Auth0_c {
|
|
6
6
|
constructor(ctx1){
|
|
7
7
|
this.ctx = ctx1;
|
|
8
|
-
this.login_auth0_body_ =
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
this.post_auth0_auth_change_password = post_auth0_auth_change_password_b(this.ctx);
|
|
23
|
-
this.post_auth0_passwordless_start = post_auth0_passwordless_start_b(this.ctx);
|
|
8
|
+
this.login_auth0_body_ = (data)=>auth0_body_(this.ctx, data)
|
|
9
|
+
;
|
|
10
|
+
this.login_password_realm_body_ = (data)=>password_realm_body_(this.ctx, this.login_auth0_body_(data))
|
|
11
|
+
;
|
|
12
|
+
this.signup_auth0_body_ = (data)=>auth0_body_(this.ctx, data)
|
|
13
|
+
;
|
|
14
|
+
this.signup_password_realm_body_ = (data)=>password_realm_body_(this.ctx, this.signup_auth0_body_(data))
|
|
15
|
+
;
|
|
16
|
+
this.auth0_opened_class = auth0_opened_class$_(this.ctx);
|
|
17
|
+
this.auth0_token_json$ = auth0_token_json$_(this.ctx);
|
|
18
|
+
this.auth0_token_error$ = auth0_token_error$_(this.ctx);
|
|
19
|
+
this.clear_auth0_token_error = clear_auth0_token_error_(this.ctx);
|
|
20
|
+
this.close_auth0 = ()=>close_auth0(this.ctx)
|
|
21
|
+
;
|
|
24
22
|
this.onMount = async (root)=>{
|
|
25
23
|
if (has_dom) {
|
|
26
24
|
const unsubscribe = this.auth0_opened_class.subscribe(()=>this.schedule_forms_clear(root)
|
|
@@ -29,7 +27,7 @@ export class Auth0_c {
|
|
|
29
27
|
}
|
|
30
28
|
};
|
|
31
29
|
this.login = async (data, schedule_forms_clear = ()=>{})=>{
|
|
32
|
-
const [auth0_token, response] = await
|
|
30
|
+
const [auth0_token, response] = await post_auth0_oauth_token(this.ctx, this.login_password_realm_body_(data));
|
|
33
31
|
if (response.ok) {
|
|
34
32
|
const auth0_token_json = JSON.stringify(auth0_token);
|
|
35
33
|
this.auth0_token_json$.$ = auth0_token_json;
|
|
@@ -38,11 +36,11 @@ export class Auth0_c {
|
|
|
38
36
|
} else {
|
|
39
37
|
const auth_token_error = auth0_token;
|
|
40
38
|
this.auth0_token_error$.$ = auth_token_error;
|
|
41
|
-
this.
|
|
39
|
+
logout_auth0_token_error(this.ctx, auth_token_error);
|
|
42
40
|
}
|
|
43
41
|
};
|
|
44
42
|
this.signup = async (data, schedule_forms_clear = ()=>{})=>{
|
|
45
|
-
const [auth0_userinfo] = await
|
|
43
|
+
const [auth0_userinfo] = await post_auth0_dbconnections_signup(this.ctx, this.signup_password_realm_body_(data));
|
|
46
44
|
const auth0_userinfo_Auth0Error = auth0_userinfo;
|
|
47
45
|
const { statusCode } = auth0_userinfo_Auth0Error;
|
|
48
46
|
if (statusCode) {
|
|
@@ -51,7 +49,7 @@ export class Auth0_c {
|
|
|
51
49
|
const auth0_token_error = {
|
|
52
50
|
email
|
|
53
51
|
};
|
|
54
|
-
this.
|
|
52
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
55
53
|
return;
|
|
56
54
|
}
|
|
57
55
|
schedule_forms_clear();
|
|
@@ -64,14 +62,14 @@ export class Auth0_c {
|
|
|
64
62
|
const { password } = form;
|
|
65
63
|
let error;
|
|
66
64
|
try {
|
|
67
|
-
const [response_json, response] = await this.
|
|
65
|
+
const [response_json, response] = await post_auth0_auth_change_password(this.ctx, password);
|
|
68
66
|
if (!response.ok) {
|
|
69
67
|
if (response.status == 401) {
|
|
70
|
-
this.
|
|
68
|
+
open_auth0_login(this.ctx);
|
|
71
69
|
const auth0_token_error = {
|
|
72
70
|
username: 'Authentication Error - Log in'
|
|
73
71
|
};
|
|
74
|
-
this.
|
|
72
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
75
73
|
return;
|
|
76
74
|
}
|
|
77
75
|
error = response_json.error || 'Error changing Password';
|
|
@@ -84,7 +82,7 @@ export class Auth0_c {
|
|
|
84
82
|
const auth0_token_error = {
|
|
85
83
|
password: error
|
|
86
84
|
};
|
|
87
|
-
this.
|
|
85
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
88
86
|
return;
|
|
89
87
|
}
|
|
90
88
|
schedule_forms_clear();
|
|
@@ -113,7 +111,7 @@ export class Auth0_c {
|
|
|
113
111
|
password_confirmation
|
|
114
112
|
});
|
|
115
113
|
if (auth0_token_error) {
|
|
116
|
-
this.
|
|
114
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
117
115
|
return false;
|
|
118
116
|
}
|
|
119
117
|
await this.signup({
|
|
@@ -143,11 +141,11 @@ export class Auth0_c {
|
|
|
143
141
|
};
|
|
144
142
|
const auth0_token_error = validate_auth0_forgot_password(data);
|
|
145
143
|
if (auth0_token_error) {
|
|
146
|
-
this.
|
|
144
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
147
145
|
return;
|
|
148
146
|
}
|
|
149
|
-
await
|
|
150
|
-
this.
|
|
147
|
+
await post_auth0_passwordless_start(this.ctx, this.login_auth0_body_(data));
|
|
148
|
+
open_auth0_forgot_password_check_email(this.ctx);
|
|
151
149
|
};
|
|
152
150
|
this.onsubmit_change_password = async (event, ctx, schedule_forms_clear = noop)=>{
|
|
153
151
|
event.preventDefault();
|
|
@@ -159,7 +157,7 @@ export class Auth0_c {
|
|
|
159
157
|
password_confirmation
|
|
160
158
|
});
|
|
161
159
|
if (auth0_token_error) {
|
|
162
|
-
this.
|
|
160
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
163
161
|
throw auth0_token_error;
|
|
164
162
|
}
|
|
165
163
|
return await this.change_password({
|
package/lib/ui/Auth0_c.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/Auth0_c.ts"],"sourcesContent":["import type { Auth0Error } from 'auth0-js'\nimport { onDestroy } from 'svelte'\nimport type {\n\tauth0_body__T, auth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, logout_auth0_token_error_T,\n\topen_auth0_forgot_password_check_email_T, open_auth0_login_T, password_realm_body__T, password_realm_body_T,\n\tpost_auth0_auth_change_password_T, post_auth0_dbconnections_signup_T, post_auth0_oauth_token_body_I,\n\tpost_auth0_oauth_token_T, post_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T,\n\tpost_auth0_passwordless_start_T, signup_data_I\n} from '@ctx-core/auth0'\nimport {\n\tauth0_body__b, auth0_opened_class$_b, auth0_token_error$_b, auth0_token_json$_b, clear_auth0_token_error_b,\n\tclose_auth0_b, logout_auth0_token_error_b, open_auth0_forgot_password_check_email_b, open_auth0_login_b,\n\tpassword_realm_body__b, post_auth0_auth_change_password_b, post_auth0_dbconnections_signup_b,\n\tpost_auth0_oauth_token_b, post_auth0_passwordless_start_b, validate_auth0_change_password,\n\tvalidate_auth0_forgot_password, validate_auth0_signup\n} from '@ctx-core/auth0'\nimport { has_dom, dom_a_ } from '@ctx-core/dom'\nimport { noop } from '@ctx-core/function'\nimport type { Ctx } from '@ctx-core/object'\nexport class Auth0_c {\n\tconstructor(protected ctx:Ctx) {}\n\treadonly login_auth0_body_ =\n\t\tauth0_body__b<login_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'login_auth0_body_') as auth0_body__T<login_data_password_realm_body_I>\n\treadonly login_password_realm_body_ = password_realm_body__b<login_data_password_realm_body_I>(\n\t\tthis.ctx,\n\t\t'login_password_realm_body_',\n\t\tthis.login_auth0_body_\n\t)\n\treadonly signup_auth0_body_ =\n\t\tauth0_body__b<signup_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'signup_auth0_body_') as auth0_body__T<signup_data_password_realm_body_I>\n\treadonly signup_password_realm_body_:password_realm_body__T<signup_data_password_realm_body_I> =\n\t\tpassword_realm_body__b<signup_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'signup_password_realm_body_fn', this.signup_auth0_body_\n\t\t)\n\treadonly auth0_opened_class = auth0_opened_class$_b(this.ctx)\n\treadonly auth0_token_json$ = auth0_token_json$_b(this.ctx)\n\treadonly auth0_token_error$ = auth0_token_error$_b(this.ctx)\n\treadonly clear_auth0_token_error = clear_auth0_token_error_b(this.ctx)\n\treadonly close_auth0 = close_auth0_b(this.ctx)\n\treadonly logout_auth0_token_error:logout_auth0_token_error_T = logout_auth0_token_error_b(this.ctx)\n\treadonly open_auth0_login:open_auth0_login_T = open_auth0_login_b(this.ctx)\n\treadonly open_auth0_forgot_password_check_email:open_auth0_forgot_password_check_email_T = open_auth0_forgot_password_check_email_b(this.ctx)\n\treadonly post_auth0_dbconnections_signup:post_auth0_dbconnections_signup_T = post_auth0_dbconnections_signup_b(this.ctx)\n\treadonly post_auth0_oauth_token:post_auth0_oauth_token_T = post_auth0_oauth_token_b(this.ctx)\n\treadonly post_auth0_auth_change_password:post_auth0_auth_change_password_T = post_auth0_auth_change_password_b(this.ctx)\n\treadonly post_auth0_passwordless_start:post_auth0_passwordless_start_T = post_auth0_passwordless_start_b(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:login_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_token, response] = await this.post_auth0_oauth_token(\n\t\t\tthis.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.close_auth0()\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\tthis.logout_auth0_token_error(auth_token_error)\n\t\t}\n\t}\n\treadonly signup = async (data:signup_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_userinfo] = await this.post_auth0_dbconnections_signup(this.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\tthis.logout_auth0_token_error(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 this.post_auth0_auth_change_password(password)\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status == 401) {\n\t\t\t\t\tthis.open_auth0_login()\n\t\t\t\t\tconst auth0_token_error = { username: 'Authentication Error - Log in' }\n\t\t\t\t\tthis.logout_auth0_token_error(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\tthis.logout_auth0_token_error(auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tschedule_forms_clear()\n\t\tthis.close_auth0()\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\tthis.clear_auth0_token_error()\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\tvalidate_auth0_signup({\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\tthis.logout_auth0_token_error(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:post_auth0_passwordless_start_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 = validate_auth0_forgot_password(data)\n\t\tif (auth0_token_error) {\n\t\t\tthis.logout_auth0_token_error(auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tawait this.post_auth0_passwordless_start(\n\t\t\tthis.login_auth0_body_(data) as post_auth0_passwordless_start_body_T\n\t\t)\n\t\tthis.open_auth0_forgot_password_check_email()\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\tvalidate_auth0_change_password(\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\tthis.logout_auth0_token_error(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.close_auth0()\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 signup_data_I,\n\t\tauth0_client_id_body_I,\n\t\tpost_auth0_passwordless_start_body_T,\n\t\tpassword_realm_body_T,\n\t\tauth0_grant_type_body_I,\n\t\tpost_auth0_oauth_token_body_I {}\nexport interface login_data_password_realm_body_I\n\textends login_data_I,\n\t\tauth0_client_id_body_I,\n\t\tpost_auth0_passwordless_start_body_T,\n\t\tpassword_realm_body_T,\n\t\tauth0_grant_type_body_I,\n\t\tpost_auth0_oauth_token_body_I {}\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":["onDestroy","auth0_body__b","auth0_opened_class$_b","auth0_token_error$_b","auth0_token_json$_b","clear_auth0_token_error_b","close_auth0_b","logout_auth0_token_error_b","open_auth0_forgot_password_check_email_b","open_auth0_login_b","password_realm_body__b","post_auth0_auth_change_password_b","post_auth0_dbconnections_signup_b","post_auth0_oauth_token_b","post_auth0_passwordless_start_b","validate_auth0_change_password","validate_auth0_forgot_password","validate_auth0_signup","has_dom","dom_a_","noop","Auth0_c","ctx","login_auth0_body_","login_password_realm_body_","signup_auth0_body_","signup_password_realm_body_","auth0_opened_class","auth0_token_json$","auth0_token_error$","clear_auth0_token_error","close_auth0","logout_auth0_token_error","open_auth0_login","open_auth0_forgot_password_check_email","post_auth0_dbconnections_signup","post_auth0_oauth_token","post_auth0_auth_change_password","post_auth0_passwordless_start","onMount","root","unsubscribe","subscribe","schedule_forms_clear","login","data","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":"AACA,MAAM,GAAGA,SAAS,QAAQ,CAAQ;AAQlC,MAAM,GACLC,aAAa,EAAEC,qBAAqB,EAAEC,oBAAoB,EAAEC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,IAAI,CAAC/C,WAAW;QACjB,CAAC;IA1L+B,CAAC;;SA4LzB4C,YAAY,CAACiB,MAAe,EAAE,CAAC;IACvC,GAAG,CAAE,GAAG,CAACC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,CAACE,MAAM,EAAED,CAAC,GAAI,CAAC;QACxC,KAAK,CAACE,KAAK,GAAGH,MAAM,CAACC,CAAC;QACtBE,KAAK,CAACb,KAAK,GAAG,CAAE;IACjB,CAAC;AACF,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/ui/Auth0_c.ts"],"sourcesContent":["import type { Auth0Error } from 'auth0-js'\nimport { onDestroy } from 'svelte'\nimport type {\n\tauth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, password_realm_body_T, post_auth0_oauth_token_body_I,\n\tpost_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T, signup_data_I\n} from '@ctx-core/auth0'\nimport {\n\tauth0_body_, auth0_opened_class$_, auth0_token_error$_, auth0_token_json$_, clear_auth0_token_error_,\n\tclose_auth0, logout_auth0_token_error, open_auth0_forgot_password_check_email, open_auth0_login,\n\tpassword_realm_body_, post_auth0_auth_change_password, post_auth0_dbconnections_signup,\n\tpost_auth0_oauth_token, post_auth0_passwordless_start, validate_auth0_change_password,\n\tvalidate_auth0_forgot_password, validate_auth0_signup\n} from '@ctx-core/auth0'\nimport { has_dom, dom_a_ } from '@ctx-core/dom'\nimport { noop } from '@ctx-core/function'\nimport type { Ctx } from '@ctx-core/object'\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 clear_auth0_token_error = clear_auth0_token_error_(this.ctx)\n\treadonly close_auth0 = ()=>close_auth0(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:login_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_token, response] = await post_auth0_oauth_token(\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.close_auth0()\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\tlogout_auth0_token_error(this.ctx, auth_token_error)\n\t\t}\n\t}\n\treadonly signup = async (data:signup_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_userinfo] = await post_auth0_dbconnections_signup(\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\tlogout_auth0_token_error(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 post_auth0_auth_change_password(this.ctx, password)\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status == 401) {\n\t\t\t\t\topen_auth0_login(this.ctx)\n\t\t\t\t\tconst auth0_token_error = { username: 'Authentication Error - Log in' }\n\t\t\t\t\tlogout_auth0_token_error(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\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tschedule_forms_clear()\n\t\tthis.close_auth0()\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\tthis.clear_auth0_token_error()\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\tvalidate_auth0_signup({\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\tlogout_auth0_token_error(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:post_auth0_passwordless_start_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 = validate_auth0_forgot_password(data)\n\t\tif (auth0_token_error) {\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tawait post_auth0_passwordless_start(\n\t\t\tthis.ctx, this.login_auth0_body_(data) as post_auth0_passwordless_start_body_T\n\t\t)\n\t\topen_auth0_forgot_password_check_email(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\tvalidate_auth0_change_password(\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\tlogout_auth0_token_error(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.close_auth0()\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 signup_data_I,\n\t\tauth0_client_id_body_I,\n\t\tpost_auth0_passwordless_start_body_T,\n\t\tpassword_realm_body_T,\n\t\tauth0_grant_type_body_I,\n\t\tpost_auth0_oauth_token_body_I {}\nexport interface login_data_password_realm_body_I\n\textends login_data_I,\n\t\tauth0_client_id_body_I,\n\t\tpost_auth0_passwordless_start_body_T,\n\t\tpassword_realm_body_T,\n\t\tauth0_grant_type_body_I,\n\t\tpost_auth0_oauth_token_body_I {}\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":["onDestroy","auth0_body_","auth0_opened_class$_","auth0_token_error$_","auth0_token_json$_","clear_auth0_token_error_","close_auth0","logout_auth0_token_error","open_auth0_forgot_password_check_email","open_auth0_login","password_realm_body_","post_auth0_auth_change_password","post_auth0_dbconnections_signup","post_auth0_oauth_token","post_auth0_passwordless_start","validate_auth0_change_password","validate_auth0_forgot_password","validate_auth0_signup","has_dom","dom_a_","noop","Auth0_c","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$","clear_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":"AACA,MAAM,GAAGA,SAAS,QAAQ,CAAQ;AAKlC,MAAM,GACLC,WAAW,EAAEC,oBAAoB,EAAEC,mBAAmB,EAAEC,kBAAkB,EAAEC,wBAAwB,EACpGC,WAAW,EAAEC,wBAAwB,EAAEC,sCAAsC,EAAEC,gBAAgB,EAC/FC,oBAAoB,EAAEC,+BAA+B,EAAEC,+BAA+B,EACtFC,sBAAsB,EAAEC,6BAA6B,EAAEC,8BAA8B,EACrFC,8BAA8B,EAAEC,qBAAqB,QAC/C,CAAiB;AACxB,MAAM,GAAGC,OAAO,EAAEC,MAAM,QAAQ,CAAe;AAC/C,MAAM,GAAGC,IAAI,QAAQ,CAAoB;AAEzC,MAAM,OAAOC,OAAO;gBACGC,IAAO,CAAE,CAAC;aAAVA,GAAO,GAAPA,IAAO;QADvB,IAqLN,CAnLSC,iBAAiB,IAAIC,IAAQ,GACrCvB,WAAW,CACV,IAAI,CAACqB,GAAG,EAAEE,IAAI;;QAJV,IAqLN,CA/KSC,0BAA0B,IAAID,IAAQ,GAC9Cd,oBAAoB,CACnB,IAAI,CAACY,GAAG,EACR,IAAI,CAACC,iBAAiB,CAACC,IAAI;;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;gBACvB9C,wBAAwB,CAAC,IAAI,CAACe,GAAG,EAAE+B,iBAAiB;gBACpD,KAAK,CAACA,iBAAiB;YACxB,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,IAAI,CAACG,eAAe,CAAC,CAAC;gBAACD,QAAQ;YAAC,CAAC,EAAEnB,oBAAoB;QACrE,CAAC;QAhLK,IAqLN,CAJS+C,OAAO,UAAUd,KAAgB,GAAG,CAAC;YAC7CA,KAAK,CAACC,cAAc;YACpB,IAAI,CAAChE,WAAW;QACjB,CAAC;IAnL+B,CAAC;;SAqLzB6D,YAAY,CAACiB,MAAe,EAAE,CAAC;IACvC,GAAG,CAAE,GAAG,CAACC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,CAACE,MAAM,EAAED,CAAC,GAAI,CAAC;QACxC,KAAK,CAACE,KAAK,GAAGH,MAAM,CAACC,CAAC;QACtBE,KAAK,CAACb,KAAK,GAAG,CAAE;IACjB,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/auth0-ui",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.9",
|
|
4
4
|
"description": "ctx-core auth0 ui component & express endpoints",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ctx-core/auth0": "^
|
|
30
|
-
"@ctx-core/auth0-management": "^
|
|
31
|
-
"@ctx-core/dialog": "^
|
|
29
|
+
"@ctx-core/auth0": "^30.0.0",
|
|
30
|
+
"@ctx-core/auth0-management": "^9.0.0",
|
|
31
|
+
"@ctx-core/dialog": "^19.0.0",
|
|
32
32
|
"@ctx-core/dialog-ui-svelte": "^1.0.14",
|
|
33
33
|
"@ctx-core/dom": "^11.1.5",
|
|
34
|
-
"@ctx-core/error": "^11.
|
|
35
|
-
"@ctx-core/fetch-undici": "^1.1.
|
|
34
|
+
"@ctx-core/error": "^11.3.0",
|
|
35
|
+
"@ctx-core/fetch-undici": "^1.1.1",
|
|
36
36
|
"@ctx-core/function": "^20.4.0",
|
|
37
37
|
"@ctx-core/http": "^9.0.22",
|
|
38
38
|
"@ctx-core/jwt": "^10.0.50",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@ctx-core/object": "^22.0.13",
|
|
41
41
|
"@ctx-core/svelte": "^10.1.7",
|
|
42
42
|
"@swc/cli": "^0.1.55",
|
|
43
|
-
"@swc/core": "^1.2.
|
|
44
|
-
"auth0-js": "^9.
|
|
43
|
+
"@swc/core": "^1.2.135",
|
|
44
|
+
"auth0-js": "^9.19.0",
|
|
45
45
|
"jsonwebtoken": "^8.5.1",
|
|
46
46
|
"polka": "next"
|
|
47
47
|
},
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"@types/jsonwebtoken": "^8.5.8",
|
|
53
53
|
"@types/trouter": "^3.1.1",
|
|
54
54
|
"rimraf": "^3.0.2",
|
|
55
|
-
"svelte": "^3.46.
|
|
56
|
-
"svelte-check": "^2.
|
|
55
|
+
"svelte": "^3.46.3",
|
|
56
|
+
"svelte-check": "^2.4.0",
|
|
57
57
|
"svelte-preprocess": "^4.10.2",
|
|
58
|
-
"svelte2tsx": "^0.
|
|
58
|
+
"svelte2tsx": "^0.5.0",
|
|
59
59
|
"tslib": "^2.3.1",
|
|
60
60
|
"typescript": "next"
|
|
61
61
|
},
|
package/src/ui/Auth0.svelte
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { setContext } from 'svelte'
|
|
3
3
|
import {
|
|
4
|
-
auth0_forgot_password_opened$
|
|
5
|
-
auth0_forgot_password_check_email_opened$
|
|
4
|
+
auth0_forgot_password_opened$_, auth0_opened_class$_, auth0_login_opened$_, auth0_signup_opened$_,
|
|
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
8
|
import { auth0_ui_ctx_key } from '../auth0_ui_ctx_key.js'
|
|
@@ -15,12 +15,12 @@ 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
17
|
setContext(auth0_ui_ctx_key, ctx)
|
|
18
|
-
const auth0_change_password_opened$ = auth0_change_password_opened$
|
|
19
|
-
const auth0_opened_class$ = auth0_opened_class$
|
|
20
|
-
const auth0_forgot_password_check_email_opened$ = auth0_forgot_password_check_email_opened$
|
|
21
|
-
const auth0_forgot_password_opened$ = auth0_forgot_password_opened$
|
|
22
|
-
const auth0_login_opened$ = auth0_login_opened$
|
|
23
|
-
const auth0_signup_opened$ = auth0_signup_opened$
|
|
18
|
+
const auth0_change_password_opened$ = auth0_change_password_opened$_(ctx)
|
|
19
|
+
const auth0_opened_class$ = auth0_opened_class$_(ctx)
|
|
20
|
+
const auth0_forgot_password_check_email_opened$ = auth0_forgot_password_check_email_opened$_(ctx)
|
|
21
|
+
const auth0_forgot_password_opened$ = auth0_forgot_password_opened$_(ctx)
|
|
22
|
+
const auth0_login_opened$ = auth0_login_opened$_(ctx)
|
|
23
|
+
const auth0_signup_opened$ = auth0_signup_opened$_(ctx)
|
|
24
24
|
const _ = new Auth0_c(ctx)
|
|
25
25
|
</script>
|
|
26
26
|
|
|
@@ -61,38 +61,38 @@ const _ = new Auth0_c(ctx)
|
|
|
61
61
|
font-size: 2rem;
|
|
62
62
|
text-align: center;
|
|
63
63
|
}
|
|
64
|
-
[name=
|
|
64
|
+
[name=auth_navigation] {
|
|
65
65
|
display: none;
|
|
66
66
|
~ .form {
|
|
67
67
|
display: none;
|
|
68
68
|
}
|
|
69
|
-
&.
|
|
69
|
+
&.auth_navigation-signup:checked {
|
|
70
70
|
~ .signup {
|
|
71
71
|
display: block;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
&.
|
|
74
|
+
&.auth_navigation-login:checked {
|
|
75
75
|
~ .login {
|
|
76
76
|
display: block;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
&.
|
|
79
|
+
&.auth_navigation-forgot_password:checked {
|
|
80
80
|
~ .forgot_password {
|
|
81
81
|
display: block;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
&.
|
|
84
|
+
&.auth_navigation-forgot_password_check_email:checked {
|
|
85
85
|
~ .forgot_password_check_email {
|
|
86
86
|
display: block;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
&.
|
|
89
|
+
&.auth_navigation-change_password:checked {
|
|
90
90
|
~ .change_password {
|
|
91
91
|
display: block;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
:global(label.
|
|
95
|
+
:global(label.auth_navigation) {
|
|
96
96
|
color: #3EBBC0;
|
|
97
97
|
font-weight: bold;
|
|
98
98
|
&:hover {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import { AUTH0_DOMAIN$
|
|
3
|
+
import { AUTH0_DOMAIN$_, auth0_token_error$_ } from '@ctx-core/auth0'
|
|
4
4
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.js'
|
|
5
5
|
import { Auth0_c } from './Auth0_c.js'
|
|
6
6
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
7
7
|
const ctx = getContext_auth0_ui_ctx()
|
|
8
8
|
const dispatch = createEventDispatcher()
|
|
9
9
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
10
|
-
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$
|
|
11
|
-
const auth0_token_error$ = auth0_token_error$
|
|
10
|
+
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_(ctx)
|
|
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
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { AUTH0_DOMAIN$
|
|
2
|
+
import { AUTH0_DOMAIN$_, auth0_token_error$_, open_auth0_login, open_auth0_signup } from '@ctx-core/auth0'
|
|
3
3
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.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
7
|
const ctx = getContext_auth0_ui_ctx()
|
|
8
|
-
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$
|
|
9
|
-
const auth0_token_error$ = auth0_token_error$
|
|
10
|
-
const open_auth0_login = open_auth0_login_b(ctx)
|
|
11
|
-
const open_auth0_signup = open_auth0_signup_b(ctx)
|
|
8
|
+
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_(ctx)
|
|
9
|
+
const auth0_token_error$ = auth0_token_error$_(ctx)
|
|
12
10
|
const _ = new Auth0_c(ctx)
|
|
13
11
|
let email_input:HTMLInputElement, error:string
|
|
14
12
|
$: error = $auth0_token_error$?.error
|
|
@@ -51,12 +49,12 @@ $: error = $auth0_token_error$?.error
|
|
|
51
49
|
class="button {button_class}"
|
|
52
50
|
/>
|
|
53
51
|
<label
|
|
54
|
-
class="
|
|
55
|
-
on:click={open_auth0_login}
|
|
52
|
+
class="auth_navigation {label_class}"
|
|
53
|
+
on:click={()=>open_auth0_login(ctx)}
|
|
56
54
|
>Have an account? Log in…</label>
|
|
57
55
|
<label
|
|
58
|
-
class="
|
|
59
|
-
on:click={open_auth0_signup}
|
|
56
|
+
class="auth_navigation {label_class}"
|
|
57
|
+
on:click={()=>open_auth0_signup(ctx)}
|
|
60
58
|
>Don't have an account? Signup…</label>
|
|
61
59
|
</footer>
|
|
62
60
|
</form>
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
AUTH0_DOMAIN$
|
|
3
|
+
AUTH0_DOMAIN$_, auth0_token_error$_, auth0_token_error_txt$_, open_auth0_forgot_password, open_auth0_signup
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
5
|
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 auth0_token_error$ = auth0_token_error$
|
|
10
|
-
const auth0_token_error_txt$ = auth0_token_error_txt$
|
|
11
|
-
const AUTH0_DOMAIN = AUTH0_DOMAIN$
|
|
12
|
-
const open_auth0_signup = open_auth0_signup_b(ctx)
|
|
13
|
-
const open_auth0_forgot_password = open_auth0_forgot_password_b(ctx)
|
|
9
|
+
const auth0_token_error$ = auth0_token_error$_(ctx)
|
|
10
|
+
const auth0_token_error_txt$ = auth0_token_error_txt$_(ctx)
|
|
11
|
+
const AUTH0_DOMAIN = AUTH0_DOMAIN$_(ctx)
|
|
14
12
|
const _ = new Auth0_c(ctx)
|
|
15
13
|
let root:HTMLDivElement
|
|
16
14
|
let username_login_input:HTMLInputElement, password_login_input:HTMLInputElement
|
|
@@ -73,12 +71,12 @@ $: error_password = $auth0_token_error$?.password //endregion
|
|
|
73
71
|
class="button {button_class}"
|
|
74
72
|
/>
|
|
75
73
|
<label
|
|
76
|
-
class="
|
|
77
|
-
on:click={open_auth0_signup}
|
|
74
|
+
class="auth_navigation {label_class}"
|
|
75
|
+
on:click={()=>open_auth0_signup(ctx)}
|
|
78
76
|
>Don't have an account? Signup…</label>
|
|
79
77
|
<label
|
|
80
|
-
class="
|
|
81
|
-
on:click={open_auth0_forgot_password}
|
|
78
|
+
class="auth_navigation {label_class}"
|
|
79
|
+
on:click={()=>open_auth0_forgot_password(ctx)}
|
|
82
80
|
>Forgot Password?</label>
|
|
83
81
|
</footer>
|
|
84
82
|
</form>
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
AUTH0_DOMAIN$
|
|
3
|
+
AUTH0_DOMAIN$_, auth0_token_error$_, open_auth0_forgot_password, open_auth0_login,
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
5
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.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
9
|
const ctx = getContext_auth0_ui_ctx()
|
|
10
|
-
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$
|
|
11
|
-
const auth0_token_error$ = auth0_token_error$
|
|
12
|
-
const open_auth0_login = open_auth0_login_b(ctx)
|
|
13
|
-
const open_auth0_forgot_password = open_auth0_forgot_password_b(ctx)
|
|
10
|
+
const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_(ctx)
|
|
11
|
+
const auth0_token_error$ = auth0_token_error$_(ctx)
|
|
14
12
|
const _ = new Auth0_c(ctx)
|
|
15
13
|
let root, signup_email_input, signup_password_input, signup_password_confirmation_input
|
|
16
14
|
let error_username:string|undefined //region
|
|
@@ -107,12 +105,12 @@ $: {
|
|
|
107
105
|
class="button {button_class}"
|
|
108
106
|
/>
|
|
109
107
|
<label
|
|
110
|
-
class="
|
|
111
|
-
on:click={open_auth0_login}
|
|
108
|
+
class="auth_navigation {label_class}"
|
|
109
|
+
on:click={()=>open_auth0_login(ctx)}
|
|
112
110
|
>Have an account? Log in…</label>
|
|
113
111
|
<label
|
|
114
|
-
class="
|
|
115
|
-
on:click={open_auth0_forgot_password}
|
|
112
|
+
class="auth_navigation {label_class}"
|
|
113
|
+
on:click={()=>open_auth0_forgot_password(ctx)}
|
|
116
114
|
>Forgot Password?</label>
|
|
117
115
|
</footer>
|
|
118
116
|
</form>
|
package/src/ui/Auth0_c.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import type { Auth0Error } from 'auth0-js'
|
|
2
2
|
import { onDestroy } from 'svelte'
|
|
3
3
|
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
post_auth0_auth_change_password_T, post_auth0_dbconnections_signup_T, post_auth0_oauth_token_body_I,
|
|
7
|
-
post_auth0_oauth_token_T, post_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T,
|
|
8
|
-
post_auth0_passwordless_start_T, signup_data_I
|
|
4
|
+
auth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, password_realm_body_T, post_auth0_oauth_token_body_I,
|
|
5
|
+
post_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T, signup_data_I
|
|
9
6
|
} from '@ctx-core/auth0'
|
|
10
7
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
auth0_body_, auth0_opened_class$_, auth0_token_error$_, auth0_token_json$_, clear_auth0_token_error_,
|
|
9
|
+
close_auth0, logout_auth0_token_error, open_auth0_forgot_password_check_email, open_auth0_login,
|
|
10
|
+
password_realm_body_, post_auth0_auth_change_password, post_auth0_dbconnections_signup,
|
|
11
|
+
post_auth0_oauth_token, post_auth0_passwordless_start, validate_auth0_change_password,
|
|
15
12
|
validate_auth0_forgot_password, validate_auth0_signup
|
|
16
13
|
} from '@ctx-core/auth0'
|
|
17
14
|
import { has_dom, dom_a_ } from '@ctx-core/dom'
|
|
@@ -19,33 +16,24 @@ import { noop } from '@ctx-core/function'
|
|
|
19
16
|
import type { Ctx } from '@ctx-core/object'
|
|
20
17
|
export class Auth0_c {
|
|
21
18
|
constructor(protected ctx:Ctx) {}
|
|
22
|
-
readonly login_auth0_body_ =
|
|
23
|
-
|
|
24
|
-
this.ctx,
|
|
25
|
-
readonly login_password_realm_body_ = password_realm_body__b<login_data_password_realm_body_I>(
|
|
26
|
-
this.ctx,
|
|
27
|
-
'login_password_realm_body_',
|
|
28
|
-
this.login_auth0_body_
|
|
29
|
-
)
|
|
30
|
-
readonly signup_auth0_body_ =
|
|
31
|
-
auth0_body__b<signup_data_password_realm_body_I>(
|
|
32
|
-
this.ctx, 'signup_auth0_body_') as auth0_body__T<signup_data_password_realm_body_I>
|
|
33
|
-
readonly signup_password_realm_body_:password_realm_body__T<signup_data_password_realm_body_I> =
|
|
34
|
-
password_realm_body__b<signup_data_password_realm_body_I>(
|
|
35
|
-
this.ctx, 'signup_password_realm_body_fn', this.signup_auth0_body_
|
|
19
|
+
readonly login_auth0_body_ = (data:any)=>
|
|
20
|
+
auth0_body_<login_data_password_realm_body_I>(
|
|
21
|
+
this.ctx, data
|
|
36
22
|
)
|
|
37
|
-
readonly
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
readonly
|
|
43
|
-
|
|
44
|
-
readonly
|
|
45
|
-
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
23
|
+
readonly login_password_realm_body_ = (data:any)=>
|
|
24
|
+
password_realm_body_<login_data_password_realm_body_I>(
|
|
25
|
+
this.ctx,
|
|
26
|
+
this.login_auth0_body_(data)
|
|
27
|
+
)
|
|
28
|
+
readonly signup_auth0_body_ = (data:any)=>
|
|
29
|
+
auth0_body_<signup_data_password_realm_body_I>(this.ctx, data) as signup_data_password_realm_body_I
|
|
30
|
+
readonly signup_password_realm_body_ = (data:any)=>
|
|
31
|
+
password_realm_body_<signup_data_password_realm_body_I>(this.ctx, this.signup_auth0_body_(data))
|
|
32
|
+
readonly auth0_opened_class = auth0_opened_class$_(this.ctx)
|
|
33
|
+
readonly auth0_token_json$ = auth0_token_json$_(this.ctx)
|
|
34
|
+
readonly auth0_token_error$ = auth0_token_error$_(this.ctx)
|
|
35
|
+
readonly clear_auth0_token_error = clear_auth0_token_error_(this.ctx)
|
|
36
|
+
readonly close_auth0 = ()=>close_auth0(this.ctx)
|
|
49
37
|
readonly onMount = async (root:HTMLElement)=>{
|
|
50
38
|
if (has_dom) {
|
|
51
39
|
const unsubscribe =
|
|
@@ -54,8 +42,8 @@ export class Auth0_c {
|
|
|
54
42
|
}
|
|
55
43
|
}
|
|
56
44
|
readonly login = async (data:login_data_I, schedule_forms_clear = ()=>{})=>{
|
|
57
|
-
const [auth0_token, response] = await
|
|
58
|
-
this.login_password_realm_body_(data)
|
|
45
|
+
const [auth0_token, response] = await post_auth0_oauth_token(
|
|
46
|
+
this.ctx, this.login_password_realm_body_(data)
|
|
59
47
|
)
|
|
60
48
|
if (response.ok) {
|
|
61
49
|
const auth0_token_json = JSON.stringify(auth0_token)
|
|
@@ -65,11 +53,13 @@ export class Auth0_c {
|
|
|
65
53
|
} else {
|
|
66
54
|
const auth_token_error = auth0_token as Auth0Error
|
|
67
55
|
this.auth0_token_error$.$ = auth_token_error
|
|
68
|
-
this.
|
|
56
|
+
logout_auth0_token_error(this.ctx, auth_token_error)
|
|
69
57
|
}
|
|
70
58
|
}
|
|
71
59
|
readonly signup = async (data:signup_data_I, schedule_forms_clear = ()=>{})=>{
|
|
72
|
-
const [auth0_userinfo] = await
|
|
60
|
+
const [auth0_userinfo] = await post_auth0_dbconnections_signup(
|
|
61
|
+
this.ctx,
|
|
62
|
+
this.signup_password_realm_body_(data))
|
|
73
63
|
const auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error
|
|
74
64
|
const { statusCode } = auth0_userinfo_Auth0Error
|
|
75
65
|
if (statusCode) {
|
|
@@ -82,7 +72,7 @@ export class Auth0_c {
|
|
|
82
72
|
? 'This Email is already signed up'
|
|
83
73
|
: description || ''
|
|
84
74
|
const auth0_token_error = { email }
|
|
85
|
-
this.
|
|
75
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
86
76
|
return
|
|
87
77
|
}
|
|
88
78
|
schedule_forms_clear()
|
|
@@ -95,12 +85,12 @@ export class Auth0_c {
|
|
|
95
85
|
const { password } = form
|
|
96
86
|
let error
|
|
97
87
|
try {
|
|
98
|
-
const [response_json, response] = await this.
|
|
88
|
+
const [response_json, response] = await post_auth0_auth_change_password(this.ctx, password)
|
|
99
89
|
if (!response.ok) {
|
|
100
90
|
if (response.status == 401) {
|
|
101
|
-
this.
|
|
91
|
+
open_auth0_login(this.ctx)
|
|
102
92
|
const auth0_token_error = { username: 'Authentication Error - Log in' }
|
|
103
|
-
this.
|
|
93
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
104
94
|
return
|
|
105
95
|
}
|
|
106
96
|
error = response_json.error || 'Error changing Password'
|
|
@@ -111,7 +101,7 @@ export class Auth0_c {
|
|
|
111
101
|
}
|
|
112
102
|
if (error) {
|
|
113
103
|
const auth0_token_error = { password: error }
|
|
114
|
-
this.
|
|
104
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
115
105
|
return
|
|
116
106
|
}
|
|
117
107
|
schedule_forms_clear()
|
|
@@ -144,7 +134,7 @@ export class Auth0_c {
|
|
|
144
134
|
password_confirmation
|
|
145
135
|
})
|
|
146
136
|
if (auth0_token_error) {
|
|
147
|
-
this.
|
|
137
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
148
138
|
return false
|
|
149
139
|
}
|
|
150
140
|
await this.signup({
|
|
@@ -171,13 +161,13 @@ export class Auth0_c {
|
|
|
171
161
|
}
|
|
172
162
|
const auth0_token_error = validate_auth0_forgot_password(data)
|
|
173
163
|
if (auth0_token_error) {
|
|
174
|
-
this.
|
|
164
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
175
165
|
return
|
|
176
166
|
}
|
|
177
|
-
await
|
|
178
|
-
this.login_auth0_body_(data) as post_auth0_passwordless_start_body_T
|
|
167
|
+
await post_auth0_passwordless_start(
|
|
168
|
+
this.ctx, this.login_auth0_body_(data) as post_auth0_passwordless_start_body_T
|
|
179
169
|
)
|
|
180
|
-
this.
|
|
170
|
+
open_auth0_forgot_password_check_email(this.ctx)
|
|
181
171
|
}
|
|
182
172
|
readonly onsubmit_change_password = async (
|
|
183
173
|
event:Event, ctx:onsubmit_change_password_Ctx, schedule_forms_clear = noop
|
|
@@ -196,7 +186,7 @@ export class Auth0_c {
|
|
|
196
186
|
password_confirmation
|
|
197
187
|
})
|
|
198
188
|
if (auth0_token_error) {
|
|
199
|
-
this.
|
|
189
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
200
190
|
throw auth0_token_error
|
|
201
191
|
}
|
|
202
192
|
return await this.change_password({ password }, schedule_forms_clear)
|