@ctx-core/auth0-ui 12.2.7 → 12.2.11
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 +33 -0
- package/lib/src/ui/Auth0_c.d.ts +6 -14
- 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 -31
- package/lib/ui/Auth0_c.js.map +1 -1
- package/package.json +8 -8
- 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 -51
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @ctx-core/auth0-ui
|
|
2
2
|
|
|
3
|
+
## 12.2.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- update @ctx-core/auth0
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @ctx-core/auth0@30.0.2
|
|
11
|
+
|
|
12
|
+
## 12.2.10
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- update dependencies
|
|
17
|
+
|
|
18
|
+
## 12.2.9
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @ctx-core/auth0@30.0.0
|
|
24
|
+
- @ctx-core/auth0-management@9.0.0
|
|
25
|
+
- @ctx-core/dialog@19.0.0
|
|
26
|
+
- @ctx-core/fetch-undici@1.1.1
|
|
27
|
+
|
|
28
|
+
## 12.2.8
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- update dependencies
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
- @ctx-core/auth0-management@8.0.4
|
|
35
|
+
|
|
3
36
|
## 12.2.7
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/lib/src/ui/Auth0_c.d.ts
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
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
|
-
readonly
|
|
15
|
-
readonly close_auth0: import("@ctx-core/auth0").close_auth0_T;
|
|
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;
|
|
14
|
+
readonly close_auth0: () => void;
|
|
23
15
|
readonly onMount: (root: HTMLElement) => Promise<void>;
|
|
24
16
|
readonly login: (data: login_data_I, schedule_forms_clear?: () => void) => Promise<void>;
|
|
25
17
|
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,23 @@
|
|
|
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
|
-
|
|
21
|
-
this.post_auth0_oauth_token = post_auth0_oauth_token_b(this.ctx);
|
|
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.close_auth0 = ()=>close_auth0(this.ctx)
|
|
20
|
+
;
|
|
24
21
|
this.onMount = async (root)=>{
|
|
25
22
|
if (has_dom) {
|
|
26
23
|
const unsubscribe = this.auth0_opened_class.subscribe(()=>this.schedule_forms_clear(root)
|
|
@@ -29,7 +26,7 @@ export class Auth0_c {
|
|
|
29
26
|
}
|
|
30
27
|
};
|
|
31
28
|
this.login = async (data, schedule_forms_clear = ()=>{})=>{
|
|
32
|
-
const [auth0_token, response] = await
|
|
29
|
+
const [auth0_token, response] = await post_auth0_oauth_token(this.ctx, this.login_password_realm_body_(data));
|
|
33
30
|
if (response.ok) {
|
|
34
31
|
const auth0_token_json = JSON.stringify(auth0_token);
|
|
35
32
|
this.auth0_token_json$.$ = auth0_token_json;
|
|
@@ -38,11 +35,11 @@ export class Auth0_c {
|
|
|
38
35
|
} else {
|
|
39
36
|
const auth_token_error = auth0_token;
|
|
40
37
|
this.auth0_token_error$.$ = auth_token_error;
|
|
41
|
-
this.
|
|
38
|
+
logout_auth0_token_error(this.ctx, auth_token_error);
|
|
42
39
|
}
|
|
43
40
|
};
|
|
44
41
|
this.signup = async (data, schedule_forms_clear = ()=>{})=>{
|
|
45
|
-
const [auth0_userinfo] = await
|
|
42
|
+
const [auth0_userinfo] = await post_auth0_dbconnections_signup(this.ctx, this.signup_password_realm_body_(data));
|
|
46
43
|
const auth0_userinfo_Auth0Error = auth0_userinfo;
|
|
47
44
|
const { statusCode } = auth0_userinfo_Auth0Error;
|
|
48
45
|
if (statusCode) {
|
|
@@ -51,7 +48,7 @@ export class Auth0_c {
|
|
|
51
48
|
const auth0_token_error = {
|
|
52
49
|
email
|
|
53
50
|
};
|
|
54
|
-
this.
|
|
51
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
55
52
|
return;
|
|
56
53
|
}
|
|
57
54
|
schedule_forms_clear();
|
|
@@ -64,14 +61,14 @@ export class Auth0_c {
|
|
|
64
61
|
const { password } = form;
|
|
65
62
|
let error;
|
|
66
63
|
try {
|
|
67
|
-
const [response_json, response] = await this.
|
|
64
|
+
const [response_json, response] = await post_auth0_auth_change_password(this.ctx, password);
|
|
68
65
|
if (!response.ok) {
|
|
69
66
|
if (response.status == 401) {
|
|
70
|
-
this.
|
|
67
|
+
open_auth0_login(this.ctx);
|
|
71
68
|
const auth0_token_error = {
|
|
72
69
|
username: 'Authentication Error - Log in'
|
|
73
70
|
};
|
|
74
|
-
this.
|
|
71
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
74
|
error = response_json.error || 'Error changing Password';
|
|
@@ -84,7 +81,7 @@ export class Auth0_c {
|
|
|
84
81
|
const auth0_token_error = {
|
|
85
82
|
password: error
|
|
86
83
|
};
|
|
87
|
-
this.
|
|
84
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
88
85
|
return;
|
|
89
86
|
}
|
|
90
87
|
schedule_forms_clear();
|
|
@@ -96,7 +93,7 @@ export class Auth0_c {
|
|
|
96
93
|
};
|
|
97
94
|
this.schedule_forms_clear = (root)=>{
|
|
98
95
|
setTimeout(()=>{
|
|
99
|
-
this.
|
|
96
|
+
clear_auth0_token_error(this.ctx);
|
|
100
97
|
clear_inputs(dom_a_('input[type=text]', root));
|
|
101
98
|
clear_inputs(dom_a_('input[type=password]', root));
|
|
102
99
|
}, 100);
|
|
@@ -113,7 +110,7 @@ export class Auth0_c {
|
|
|
113
110
|
password_confirmation
|
|
114
111
|
});
|
|
115
112
|
if (auth0_token_error) {
|
|
116
|
-
this.
|
|
113
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
117
114
|
return false;
|
|
118
115
|
}
|
|
119
116
|
await this.signup({
|
|
@@ -143,11 +140,11 @@ export class Auth0_c {
|
|
|
143
140
|
};
|
|
144
141
|
const auth0_token_error = validate_auth0_forgot_password(data);
|
|
145
142
|
if (auth0_token_error) {
|
|
146
|
-
this.
|
|
143
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
147
144
|
return;
|
|
148
145
|
}
|
|
149
|
-
await
|
|
150
|
-
this.
|
|
146
|
+
await post_auth0_passwordless_start(this.ctx, this.login_auth0_body_(data));
|
|
147
|
+
open_auth0_forgot_password_check_email(this.ctx);
|
|
151
148
|
};
|
|
152
149
|
this.onsubmit_change_password = async (event, ctx, schedule_forms_clear = noop)=>{
|
|
153
150
|
event.preventDefault();
|
|
@@ -159,7 +156,7 @@ export class Auth0_c {
|
|
|
159
156
|
password_confirmation
|
|
160
157
|
});
|
|
161
158
|
if (auth0_token_error) {
|
|
162
|
-
this.
|
|
159
|
+
logout_auth0_token_error(this.ctx, auth0_token_error);
|
|
163
160
|
throw auth0_token_error;
|
|
164
161
|
}
|
|
165
162
|
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,mBAAmB,EAAEC,yBAAyB,EAC1GC,aAAa,EAAEC,0BAA0B,EAAEC,wCAAwC,EAAEC,kBAAkB,EACvGC,sBAAsB,EAAEC,iCAAiC,EAAEC,iCAAiC,EAC5FC,wBAAwB,EAAEC,+BAA+B,EAAEC,8BAA8B,EACzFC,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,IA4LN,CA1LSC,iBAAiB,GACzBtB,aAAa,CACZ,IAAI,CAACqB,GAAG,EAAE,CAAmB;QAJzB,IA4LN,CAvLSE,0BAA0B,GAAGd,sBAAsB,CAC3D,IAAI,CAACY,GAAG,EACR,CAA4B,6BAC5B,IAAI,CAACC,iBAAiB;QARjB,IA4LN,CAlLSE,kBAAkB,GAC1BxB,aAAa,CACZ,IAAI,CAACqB,GAAG,EAAE,CAAoB;QAZ1B,IA4LN,CA/KSI,2BAA2B,GACnChB,sBAAsB,CACrB,IAAI,CAACY,GAAG,EAAE,CAA+B,gCAAE,IAAI,CAACG,kBAAkB;QAf9D,IA4LN,CA3KSE,kBAAkB,GAAGzB,qBAAqB,CAAC,IAAI,CAACoB,GAAG;QAjBtD,IA4LN,CA1KSM,iBAAiB,GAAGxB,mBAAmB,CAAC,IAAI,CAACkB,GAAG;QAlBnD,IA4LN,CAzKSO,kBAAkB,GAAG1B,oBAAoB,CAAC,IAAI,CAACmB,GAAG;QAnBrD,IA4LN,CAxKSQ,uBAAuB,GAAGz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CAAC,IAAI,CAACG,eAAe,CAAC,CAAC;gBAACD,QAAQ;YAAC,CAAC,EAAEpB,oBAAoB;QACrE,CAAC;QAvLK,IA4LN,CAJSgD,OAAO,UAAUd,KAAgB,GAAG,CAAC;YAC7CA,KAAK,CAACC,cAAc;YACpB,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 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\tclear_auth0_token_error(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\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$","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,uBAAuB,EACnGC,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,IAoLN,CAlLSC,iBAAiB,IAAIC,IAAQ,GACrCvB,WAAW,CACV,IAAI,CAACqB,GAAG,EAAEE,IAAI;;Q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B,qBAAqB;YACtB,CAAC;YACH,EAAE,EAAEtB,iBAAiB,EAAE,CAAC;gBACvB7C,wBAAwB,CAAC,IAAI,CAACe,GAAG,EAAE8B,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;QA/KK,IAoLN,CAJS+C,OAAO,UAAUd,KAAgB,GAAG,CAAC;YAC7CA,KAAK,CAACC,cAAc;YACpB,IAAI,CAAC/D,WAAW;QACjB,CAAC;IAlL+B,CAAC;;SAoLzB4D,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.11",
|
|
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.2",
|
|
30
|
+
"@ctx-core/auth0-management": "^9.0.2",
|
|
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
34
|
"@ctx-core/error": "^11.3.0",
|
|
35
|
-
"@ctx-core/fetch-undici": "^1.1.
|
|
35
|
+
"@ctx-core/fetch-undici": "^1.1.3",
|
|
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,7 +40,7 @@
|
|
|
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.
|
|
43
|
+
"@swc/core": "^1.2.135",
|
|
44
44
|
"auth0-js": "^9.19.0",
|
|
45
45
|
"jsonwebtoken": "^8.5.1",
|
|
46
46
|
"polka": "next"
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@types/trouter": "^3.1.1",
|
|
54
54
|
"rimraf": "^3.0.2",
|
|
55
55
|
"svelte": "^3.46.3",
|
|
56
|
-
"svelte-check": "^2.
|
|
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,23 @@ 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 close_auth0 = ()=>close_auth0(this.ctx)
|
|
49
36
|
readonly onMount = async (root:HTMLElement)=>{
|
|
50
37
|
if (has_dom) {
|
|
51
38
|
const unsubscribe =
|
|
@@ -54,8 +41,8 @@ export class Auth0_c {
|
|
|
54
41
|
}
|
|
55
42
|
}
|
|
56
43
|
readonly login = async (data:login_data_I, schedule_forms_clear = ()=>{})=>{
|
|
57
|
-
const [auth0_token, response] = await
|
|
58
|
-
this.login_password_realm_body_(data)
|
|
44
|
+
const [auth0_token, response] = await post_auth0_oauth_token(
|
|
45
|
+
this.ctx, this.login_password_realm_body_(data)
|
|
59
46
|
)
|
|
60
47
|
if (response.ok) {
|
|
61
48
|
const auth0_token_json = JSON.stringify(auth0_token)
|
|
@@ -65,11 +52,13 @@ export class Auth0_c {
|
|
|
65
52
|
} else {
|
|
66
53
|
const auth_token_error = auth0_token as Auth0Error
|
|
67
54
|
this.auth0_token_error$.$ = auth_token_error
|
|
68
|
-
this.
|
|
55
|
+
logout_auth0_token_error(this.ctx, auth_token_error)
|
|
69
56
|
}
|
|
70
57
|
}
|
|
71
58
|
readonly signup = async (data:signup_data_I, schedule_forms_clear = ()=>{})=>{
|
|
72
|
-
const [auth0_userinfo] = await
|
|
59
|
+
const [auth0_userinfo] = await post_auth0_dbconnections_signup(
|
|
60
|
+
this.ctx,
|
|
61
|
+
this.signup_password_realm_body_(data))
|
|
73
62
|
const auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error
|
|
74
63
|
const { statusCode } = auth0_userinfo_Auth0Error
|
|
75
64
|
if (statusCode) {
|
|
@@ -82,7 +71,7 @@ export class Auth0_c {
|
|
|
82
71
|
? 'This Email is already signed up'
|
|
83
72
|
: description || ''
|
|
84
73
|
const auth0_token_error = { email }
|
|
85
|
-
this.
|
|
74
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
86
75
|
return
|
|
87
76
|
}
|
|
88
77
|
schedule_forms_clear()
|
|
@@ -95,12 +84,12 @@ export class Auth0_c {
|
|
|
95
84
|
const { password } = form
|
|
96
85
|
let error
|
|
97
86
|
try {
|
|
98
|
-
const [response_json, response] = await this.
|
|
87
|
+
const [response_json, response] = await post_auth0_auth_change_password(this.ctx, password)
|
|
99
88
|
if (!response.ok) {
|
|
100
89
|
if (response.status == 401) {
|
|
101
|
-
this.
|
|
90
|
+
open_auth0_login(this.ctx)
|
|
102
91
|
const auth0_token_error = { username: 'Authentication Error - Log in' }
|
|
103
|
-
this.
|
|
92
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
104
93
|
return
|
|
105
94
|
}
|
|
106
95
|
error = response_json.error || 'Error changing Password'
|
|
@@ -111,7 +100,7 @@ export class Auth0_c {
|
|
|
111
100
|
}
|
|
112
101
|
if (error) {
|
|
113
102
|
const auth0_token_error = { password: error }
|
|
114
|
-
this.
|
|
103
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
115
104
|
return
|
|
116
105
|
}
|
|
117
106
|
schedule_forms_clear()
|
|
@@ -122,7 +111,7 @@ export class Auth0_c {
|
|
|
122
111
|
}
|
|
123
112
|
readonly schedule_forms_clear = (root:HTMLElement)=>{
|
|
124
113
|
setTimeout(()=>{
|
|
125
|
-
this.
|
|
114
|
+
clear_auth0_token_error(this.ctx)
|
|
126
115
|
clear_inputs(dom_a_('input[type=text]', root))
|
|
127
116
|
clear_inputs(dom_a_('input[type=password]', root))
|
|
128
117
|
}, 100)
|
|
@@ -144,7 +133,7 @@ export class Auth0_c {
|
|
|
144
133
|
password_confirmation
|
|
145
134
|
})
|
|
146
135
|
if (auth0_token_error) {
|
|
147
|
-
this.
|
|
136
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
148
137
|
return false
|
|
149
138
|
}
|
|
150
139
|
await this.signup({
|
|
@@ -171,13 +160,13 @@ export class Auth0_c {
|
|
|
171
160
|
}
|
|
172
161
|
const auth0_token_error = validate_auth0_forgot_password(data)
|
|
173
162
|
if (auth0_token_error) {
|
|
174
|
-
this.
|
|
163
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
175
164
|
return
|
|
176
165
|
}
|
|
177
|
-
await
|
|
178
|
-
this.login_auth0_body_(data) as post_auth0_passwordless_start_body_T
|
|
166
|
+
await post_auth0_passwordless_start(
|
|
167
|
+
this.ctx, this.login_auth0_body_(data) as post_auth0_passwordless_start_body_T
|
|
179
168
|
)
|
|
180
|
-
this.
|
|
169
|
+
open_auth0_forgot_password_check_email(this.ctx)
|
|
181
170
|
}
|
|
182
171
|
readonly onsubmit_change_password = async (
|
|
183
172
|
event:Event, ctx:onsubmit_change_password_Ctx, schedule_forms_clear = noop
|
|
@@ -196,7 +185,7 @@ export class Auth0_c {
|
|
|
196
185
|
password_confirmation
|
|
197
186
|
})
|
|
198
187
|
if (auth0_token_error) {
|
|
199
|
-
this.
|
|
188
|
+
logout_auth0_token_error(this.ctx, auth0_token_error)
|
|
200
189
|
throw auth0_token_error
|
|
201
190
|
}
|
|
202
191
|
return await this.change_password({ password }, schedule_forms_clear)
|