@ctx-core/auth0-ui 13.0.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +16 -43
- package/src/auth0__script__html_/index.d.ts +6 -0
- package/src/{auth0__script__html_.ts → auth0__script__html_/index.js} +4 -6
- package/src/auth0__ui__o_key/index.d.ts +1 -0
- package/src/{auth0__ui__o_key.ts → auth0__ui__o_key/index.js} +0 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/.swcrc +0 -10
- package/lib/auth0__script__html_.js +0 -35
- package/lib/auth0__script__html_.js.map +0 -1
- package/lib/auth0__ui__o__getContext.js +0 -7
- package/lib/auth0__ui__o__getContext.js.map +0 -1
- package/lib/auth0__ui__o_key.js +0 -3
- package/lib/auth0__ui__o_key.js.map +0 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +0 -1
- package/lib/src/auth0__script__html_.d.ts +0 -2
- package/lib/src/auth0__ui__o__getContext.d.ts +0 -2
- package/lib/src/auth0__ui__o_key.d.ts +0 -1
- package/lib/src/index.d.ts +0 -4
- package/lib/src/ui/Auth0_c.d.ts +0 -48
- package/lib/src/ui/index.d.ts +0 -8
- package/lib/ui/Auth0.svelte +0 -168
- package/lib/ui/Auth0_Change_Password_Form.svelte +0 -91
- package/lib/ui/Auth0_Dialog_Close.svelte +0 -9
- package/lib/ui/Auth0_Forgot_Password_Check_Email_Form.svelte +0 -10
- package/lib/ui/Auth0_Forgot_Password_Form.svelte +0 -61
- package/lib/ui/Auth0_Login_Form.svelte +0 -83
- package/lib/ui/Auth0_Signup_Form.svelte +0 -117
- package/lib/ui/Auth0_c.js +0 -172
- package/lib/ui/Auth0_c.js.map +0 -1
- package/lib/ui/index.js +0 -10
- package/lib/ui/index.js.map +0 -1
- package/src/auth0__ui__o__getContext.ts +0 -6
- package/src/index.ts +0 -4
- package/src/ui/Auth0.svelte +0 -168
- package/src/ui/Auth0_Change_Password_Form.svelte +0 -91
- package/src/ui/Auth0_Dialog_Close.svelte +0 -9
- package/src/ui/Auth0_Forgot_Password_Check_Email_Form.svelte +0 -10
- package/src/ui/Auth0_Forgot_Password_Form.svelte +0 -61
- package/src/ui/Auth0_Login_Form.svelte +0 -83
- package/src/ui/Auth0_Signup_Form.svelte +0 -117
- package/src/ui/Auth0_c.ts +0 -251
- package/src/ui/index.ts +0 -8
- package/svelte.config.js +0 -16
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import { AUTH0_DOMAIN__, auth0__token__error__ } from '@ctx-core/auth0'
|
|
4
|
-
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
5
|
-
import { Auth0_c } from './Auth0_c.js'
|
|
6
|
-
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
7
|
-
const ctx = auth0__ui__o__getContext()
|
|
8
|
-
const dispatch = createEventDispatcher()
|
|
9
|
-
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
10
|
-
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
-
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
12
|
-
const _ = new Auth0_c(ctx)
|
|
13
|
-
let root:HTMLDivElement
|
|
14
|
-
let password_input:HTMLInputElement
|
|
15
|
-
let password_confirmation_input
|
|
16
|
-
let password_error:any|undefined //region
|
|
17
|
-
$: password_error = $auth0_token_error_?.password //endregion
|
|
18
|
-
let password_error_confirmation:string|undefined //region
|
|
19
|
-
$: password_error_confirmation = $auth0_token_error_?.password_confirmation //endregion
|
|
20
|
-
async function change_password__onsubmit(event:FormDataEvent) {
|
|
21
|
-
dispatch('submit__start')
|
|
22
|
-
try {
|
|
23
|
-
await _.change_password__onsubmit(event, {
|
|
24
|
-
password_input,
|
|
25
|
-
password_confirmation_input,
|
|
26
|
-
}, ()=>_.forms__clear__schedule(root))
|
|
27
|
-
dispatch('success')
|
|
28
|
-
} catch (error) {
|
|
29
|
-
dispatch('error', { error })
|
|
30
|
-
throw error
|
|
31
|
-
} finally {
|
|
32
|
-
dispatch('submit__end')
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<div bind:this={root} class="form change_password Auth0_Change_Password_Form">
|
|
38
|
-
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
39
|
-
<h1>Change Password</h1>
|
|
40
|
-
<form
|
|
41
|
-
action="https://{$AUTH0_DOMAIN_}/dbconnections/change_password"
|
|
42
|
-
accept-charset="UTF-8"
|
|
43
|
-
method="post"
|
|
44
|
-
on:submit|preventDefault={change_password__onsubmit}
|
|
45
|
-
>
|
|
46
|
-
{#if $auth0_token_error_}
|
|
47
|
-
<ul>
|
|
48
|
-
{#if password_error}
|
|
49
|
-
<li class="error {error_class}">
|
|
50
|
-
{password_error}
|
|
51
|
-
</li>
|
|
52
|
-
{/if}
|
|
53
|
-
{#if password_error_confirmation}
|
|
54
|
-
<li class="error {error_class}">
|
|
55
|
-
{password_error_confirmation}
|
|
56
|
-
</li>
|
|
57
|
-
{/if}
|
|
58
|
-
</ul>
|
|
59
|
-
{/if}
|
|
60
|
-
<fieldset>
|
|
61
|
-
<label class="field">
|
|
62
|
-
<div class={label_class}>Password</div>
|
|
63
|
-
<input
|
|
64
|
-
bind:this={password_input}
|
|
65
|
-
placeholder="**********"
|
|
66
|
-
required="required"
|
|
67
|
-
class={input_class}
|
|
68
|
-
class:invalid={password_error}
|
|
69
|
-
id="password-change_password"
|
|
70
|
-
type="password"
|
|
71
|
-
name="password"/>
|
|
72
|
-
</label>
|
|
73
|
-
<label class="field">
|
|
74
|
-
<div class={label_class}>Confirm Password</div>
|
|
75
|
-
<input
|
|
76
|
-
bind:this={password_confirmation_input}
|
|
77
|
-
type="password"
|
|
78
|
-
id="password_confirmation-change_password"
|
|
79
|
-
name="password_confirmation"
|
|
80
|
-
class={input_class}
|
|
81
|
-
class:invalid={password_error_confirmation}
|
|
82
|
-
required="required"
|
|
83
|
-
placeholder="**********"
|
|
84
|
-
/>
|
|
85
|
-
</label>
|
|
86
|
-
</fieldset>
|
|
87
|
-
<footer>
|
|
88
|
-
<input type="submit" value="Change Password" class="button {button_class}"/>
|
|
89
|
-
</footer>
|
|
90
|
-
</form>
|
|
91
|
-
</div>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { CloseDialogHandle } from '@ctx-core/dialog-ui-svelte'
|
|
3
|
-
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
4
|
-
import { Auth0_c } from './Auth0_c.js'
|
|
5
|
-
const ctx = auth0__ui__o__getContext()
|
|
6
|
-
const _ = new Auth0_c(ctx)
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<CloseDialogHandle on:click={_.onclose}></CloseDialogHandle>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
3
|
-
let root:HTMLDivElement
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<div bind:this={root} class="form forgot_password_check_email">
|
|
7
|
-
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
8
|
-
<h1>Check Your Email</h1>
|
|
9
|
-
<p>An email to reset you password has been sent to you.</p>
|
|
10
|
-
</div>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { AUTH0_DOMAIN__, auth0__token__error__, auth0__login__open, auth0__signup__open } from '@ctx-core/auth0'
|
|
3
|
-
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
4
|
-
import { Auth0_c } from './Auth0_c.js'
|
|
5
|
-
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
6
|
-
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
7
|
-
const ctx = auth0__ui__o__getContext()
|
|
8
|
-
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
9
|
-
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
10
|
-
const _ = new Auth0_c(ctx)
|
|
11
|
-
let email_input:HTMLInputElement, error:typeof $auth0_token_error_?.error
|
|
12
|
-
$: error = $auth0_token_error_?.error
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<div class="form forgot_password">
|
|
16
|
-
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
17
|
-
<h1>Forgot Password</h1>
|
|
18
|
-
<form
|
|
19
|
-
action="https://{$AUTH0_DOMAIN_}/passwordless/start"
|
|
20
|
-
accept-charset="UTF-8"
|
|
21
|
-
method="post"
|
|
22
|
-
on:submit={event => _.forgot_password__onsubmit(event, { email_input })}
|
|
23
|
-
>
|
|
24
|
-
{#if $auth0_token_error_}
|
|
25
|
-
<ul>
|
|
26
|
-
<li class="error {error_class}">
|
|
27
|
-
{$auth0_token_error_.error}: {$auth0_token_error_.error_description}
|
|
28
|
-
</li>
|
|
29
|
-
</ul>
|
|
30
|
-
{/if}
|
|
31
|
-
<fieldset>
|
|
32
|
-
<label class="field">
|
|
33
|
-
<div class={label_class}>Email</div>
|
|
34
|
-
<input
|
|
35
|
-
bind:this={email_input}
|
|
36
|
-
placeholder="your@email.com"
|
|
37
|
-
required="required"
|
|
38
|
-
class="form-control {input_class}"
|
|
39
|
-
class:invalid={error}
|
|
40
|
-
type="email"
|
|
41
|
-
id="email-forgot_password"
|
|
42
|
-
name="email"/>
|
|
43
|
-
</label>
|
|
44
|
-
</fieldset>
|
|
45
|
-
<footer>
|
|
46
|
-
<input
|
|
47
|
-
type="submit"
|
|
48
|
-
value="Reset Password"
|
|
49
|
-
class="button {button_class}"
|
|
50
|
-
/>
|
|
51
|
-
<label
|
|
52
|
-
class="auth_navigation {label_class}"
|
|
53
|
-
on:click={()=>auth0__login__open(ctx)}
|
|
54
|
-
>Have an account? Log in…</label>
|
|
55
|
-
<label
|
|
56
|
-
class="auth_navigation {label_class}"
|
|
57
|
-
on:click={()=>auth0__signup__open(ctx)}
|
|
58
|
-
>Don't have an account? Signup…</label>
|
|
59
|
-
</footer>
|
|
60
|
-
</form>
|
|
61
|
-
</div>
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
AUTH0_DOMAIN__, auth0__token__error__, auth0__token__error_txt__, auth0__forgot_password__open, auth0__signup__open
|
|
4
|
-
} from '@ctx-core/auth0'
|
|
5
|
-
import { type Ctx } from '@ctx-core/object'
|
|
6
|
-
import { Auth0_c } from './Auth0_c.js'
|
|
7
|
-
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
|
-
export let ctx:Ctx, error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
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)
|
|
12
|
-
const _ = new Auth0_c(ctx)
|
|
13
|
-
let root:HTMLDivElement
|
|
14
|
-
let username_login_input:HTMLInputElement, password_login_input:HTMLInputElement
|
|
15
|
-
let error_username:string|undefined//region
|
|
16
|
-
$: error_username = $auth0_token_error_?.username //endregion
|
|
17
|
-
let error_password:string|undefined//region
|
|
18
|
-
$: error_password = $auth0_token_error_?.password //endregion
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<div bind:this={root} class="form {$$props.class||''}">
|
|
22
|
-
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
23
|
-
<h1><slot name="login_text">Welcome</slot></h1>
|
|
24
|
-
<form
|
|
25
|
-
action="https://{$AUTH0_DOMAIN}/oauth/token"
|
|
26
|
-
accept-charset="UTF-8"
|
|
27
|
-
method="post"
|
|
28
|
-
on:submit={event =>
|
|
29
|
-
_.login__onsubmit(event, {
|
|
30
|
-
username_login_input,
|
|
31
|
-
password_login_input
|
|
32
|
-
}, ()=>_.forms__clear__schedule(root))}
|
|
33
|
-
>
|
|
34
|
-
{#if $auth0_token_error_txt_}
|
|
35
|
-
<ul>
|
|
36
|
-
<li class="error {error_class}">
|
|
37
|
-
{$auth0_token_error_txt_}
|
|
38
|
-
</li>
|
|
39
|
-
</ul>
|
|
40
|
-
{/if}
|
|
41
|
-
<fieldset>
|
|
42
|
-
<label class="field">
|
|
43
|
-
<div class={label_class}>Email</div>
|
|
44
|
-
<input
|
|
45
|
-
bind:this={username_login_input}
|
|
46
|
-
placeholder="your@email.com"
|
|
47
|
-
required="required"
|
|
48
|
-
class="form-control {input_class}"
|
|
49
|
-
class:invalid={error_username}
|
|
50
|
-
type="email"
|
|
51
|
-
id="username-login"
|
|
52
|
-
name="username"/>
|
|
53
|
-
</label>
|
|
54
|
-
<label class="field">
|
|
55
|
-
<div class={label_class}>Password</div>
|
|
56
|
-
<input
|
|
57
|
-
bind:this={password_login_input}
|
|
58
|
-
placeholder="**********"
|
|
59
|
-
required="required"
|
|
60
|
-
class={input_class}
|
|
61
|
-
class:invalid={error_password}
|
|
62
|
-
id="password-login"
|
|
63
|
-
type="password"
|
|
64
|
-
name="password"/>
|
|
65
|
-
</label>
|
|
66
|
-
</fieldset>
|
|
67
|
-
<footer>
|
|
68
|
-
<input
|
|
69
|
-
type="submit"
|
|
70
|
-
value="Login"
|
|
71
|
-
class="button {button_class}"
|
|
72
|
-
/>
|
|
73
|
-
<label
|
|
74
|
-
class="auth_navigation {label_class}"
|
|
75
|
-
on:click={()=>auth0__signup__open(ctx)}
|
|
76
|
-
>Don't have an account? Signup…</label>
|
|
77
|
-
<label
|
|
78
|
-
class="auth_navigation {label_class}"
|
|
79
|
-
on:click={()=>auth0__forgot_password__open(ctx)}
|
|
80
|
-
>Forgot Password?</label>
|
|
81
|
-
</footer>
|
|
82
|
-
</form>
|
|
83
|
-
</div>
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
AUTH0_DOMAIN__, auth0__token__error__, auth0__forgot_password__open, auth0__login__open,
|
|
4
|
-
} from '@ctx-core/auth0'
|
|
5
|
-
import { auth0__ui__o__getContext } from '../auth0__ui__o__getContext.js'
|
|
6
|
-
import { Auth0_c } from './Auth0_c.js'
|
|
7
|
-
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
|
-
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
|
-
const ctx = auth0__ui__o__getContext()
|
|
10
|
-
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
-
const auth0__token__error_ = auth0__token__error__(ctx)
|
|
12
|
-
const _ = new Auth0_c(ctx)
|
|
13
|
-
let root, signup_email_input, signup_password_input, signup_password_confirmation_input
|
|
14
|
-
let error_username:string|undefined //region
|
|
15
|
-
$: error_username = $auth0_token_error_?.username //endregion
|
|
16
|
-
let error_password:string|undefined //region
|
|
17
|
-
$: error_password = $auth0_token_error_?.password //endregion
|
|
18
|
-
let error_password_confirmation:boolean //region
|
|
19
|
-
$: error_password_confirmation = !!$auth0_token_error_ //endregion
|
|
20
|
-
let error_text:string
|
|
21
|
-
$: {
|
|
22
|
-
let error_text_a = []
|
|
23
|
-
if ($auth0_token_error_) {
|
|
24
|
-
for (let key in $auth0_token_error_) {
|
|
25
|
-
error_text_a.push($auth0_token_error_[key])
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
error_text = error_text_a.join('<br>') || ''
|
|
29
|
-
}
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<div bind:this={root} class="form signup">
|
|
33
|
-
<Auth0_Dialog_Close/>
|
|
34
|
-
<h1><slot name="signup_text">Sign Up</slot></h1>
|
|
35
|
-
<form
|
|
36
|
-
action="https://{$AUTH0_DOMAIN_}/dbconnections/signup"
|
|
37
|
-
accept-charset="UTF-8"
|
|
38
|
-
method="post"
|
|
39
|
-
on:submit={event =>
|
|
40
|
-
_.signup__onsubmit(event, {
|
|
41
|
-
signup_email_input,
|
|
42
|
-
signup_password_input,
|
|
43
|
-
signup_password_confirmation_input
|
|
44
|
-
}, _.forms__clear__schedule(root))
|
|
45
|
-
}
|
|
46
|
-
>
|
|
47
|
-
{#if $auth0_token_error_}
|
|
48
|
-
<ul>
|
|
49
|
-
<li class="error {error_class}">
|
|
50
|
-
{error_text}
|
|
51
|
-
</li>
|
|
52
|
-
</ul>
|
|
53
|
-
{/if}
|
|
54
|
-
<fieldset>
|
|
55
|
-
<label class="field">
|
|
56
|
-
<div class={label_class}>Email</div>
|
|
57
|
-
<input
|
|
58
|
-
bind:this={signup_email_input}
|
|
59
|
-
placeholder="your@email.com"
|
|
60
|
-
required="required"
|
|
61
|
-
autocomplete="email"
|
|
62
|
-
class="form-control {input_class}"
|
|
63
|
-
class:invalid={error_username}
|
|
64
|
-
type="email"
|
|
65
|
-
id="email-signup"
|
|
66
|
-
name="email"/>
|
|
67
|
-
</label>
|
|
68
|
-
<label class="field">
|
|
69
|
-
<div class={label_class}>Password</div>
|
|
70
|
-
<input
|
|
71
|
-
bind:this={signup_password_input}
|
|
72
|
-
placeholder="**********"
|
|
73
|
-
required="required"
|
|
74
|
-
class={input_class}
|
|
75
|
-
class:invalid={error_password}
|
|
76
|
-
id="password-signup"
|
|
77
|
-
type="password"
|
|
78
|
-
name="password"/>
|
|
79
|
-
</label>
|
|
80
|
-
<label class="field">
|
|
81
|
-
<div class={label_class}>Confirm Password</div>
|
|
82
|
-
<input
|
|
83
|
-
bind:this={signup_password_confirmation_input}
|
|
84
|
-
placeholder="**********"
|
|
85
|
-
required="required"
|
|
86
|
-
class={input_class}
|
|
87
|
-
class:invalid={error_password_confirmation}
|
|
88
|
-
type="password"
|
|
89
|
-
name="password_confirmation"
|
|
90
|
-
id="password_confirmation-signup"/>
|
|
91
|
-
</label>
|
|
92
|
-
<slot name="tos__signup">
|
|
93
|
-
<p>
|
|
94
|
-
By clicking ‘Sign up’ you agree to the terms of this Website <br>
|
|
95
|
-
<a href="." target="_blank">Terms of Service</a>
|
|
96
|
-
and
|
|
97
|
-
<a href="." target="_blank">Privacy Policy</a>
|
|
98
|
-
</p>
|
|
99
|
-
</slot>
|
|
100
|
-
</fieldset>
|
|
101
|
-
<footer>
|
|
102
|
-
<input
|
|
103
|
-
type="submit"
|
|
104
|
-
value="Sign up"
|
|
105
|
-
class="button {button_class}"
|
|
106
|
-
/>
|
|
107
|
-
<label
|
|
108
|
-
class="auth_navigation {label_class}"
|
|
109
|
-
on:click={()=>auth0__login__open(ctx)}
|
|
110
|
-
>Have an account? Log in…</label>
|
|
111
|
-
<label
|
|
112
|
-
class="auth_navigation {label_class}"
|
|
113
|
-
on:click={()=>auth0__forgot_password__open(ctx)}
|
|
114
|
-
>Forgot Password?</label>
|
|
115
|
-
</footer>
|
|
116
|
-
</form>
|
|
117
|
-
</div>
|
package/src/ui/Auth0_c.ts
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
auth0__client_id__body_T,
|
|
3
|
-
auth0__grant_type__body_T,
|
|
4
|
-
auth0__login_data_T,
|
|
5
|
-
password_realm__body_T,
|
|
6
|
-
auth0__oauth_token__fetch__body_T,
|
|
7
|
-
auth0__passwordless_start__fetch__body_T,
|
|
8
|
-
auth0__passwordless_start__fetch__optional_body_T,
|
|
9
|
-
auth0__signup_data_T
|
|
10
|
-
} from '@ctx-core/auth0'
|
|
11
|
-
import {
|
|
12
|
-
auth0__body_,
|
|
13
|
-
auth0__opened__class__,
|
|
14
|
-
auth0__token__error__,
|
|
15
|
-
auth0__token__json__,
|
|
16
|
-
auth0__token__error__clear,
|
|
17
|
-
auth0__close,
|
|
18
|
-
auth0__token__error__logout,
|
|
19
|
-
auth0__forgot_password__check_email__open,
|
|
20
|
-
auth0__login__open,
|
|
21
|
-
password_realm__body_,
|
|
22
|
-
auth0__change_password__fetch_post,
|
|
23
|
-
auth0__dbconnections_signup__fetch_get,
|
|
24
|
-
auth0__oauth_token__fetch_post,
|
|
25
|
-
auth0__passwordless_start__fetch_post,
|
|
26
|
-
auth0__change_password__validate,
|
|
27
|
-
auth0__forgot_password__validate,
|
|
28
|
-
auth0__signup__validate
|
|
29
|
-
} from '@ctx-core/auth0'
|
|
30
|
-
import { dom_a_, has_dom } from '@ctx-core/dom'
|
|
31
|
-
import { noop } from '@ctx-core/function'
|
|
32
|
-
import type { Ctx } from '@ctx-core/object'
|
|
33
|
-
import type { Auth0Error } from 'auth0-js'
|
|
34
|
-
import { onDestroy } from 'svelte'
|
|
35
|
-
export class Auth0_c {
|
|
36
|
-
constructor(protected ctx:Ctx) {}
|
|
37
|
-
readonly auth0__login__body_ = (data:any)=>
|
|
38
|
-
auth0__body_<login__password_realm__body_T>(
|
|
39
|
-
this.ctx, data
|
|
40
|
-
)
|
|
41
|
-
readonly auth0__login__password_realm__body_ = (data:any)=>
|
|
42
|
-
password_realm__body_<login__password_realm__body_T>(
|
|
43
|
-
this.ctx,
|
|
44
|
-
this.auth0__login__body_(data)
|
|
45
|
-
)
|
|
46
|
-
readonly auth0__signup__body_ = (data:any)=>
|
|
47
|
-
auth0__body_<signup__password_realm__body_T>(this.ctx, data) as signup__password_realm__body_T
|
|
48
|
-
readonly auth0__signup__password_realm__body_ = (data:any)=>
|
|
49
|
-
password_realm__body_<signup__password_realm__body_T>(this.ctx, this.auth0__signup__body_(data))
|
|
50
|
-
readonly auth0__opened__class = auth0__opened__class__(this.ctx)
|
|
51
|
-
readonly auth0__token__json_ = auth0__token__json__(this.ctx)
|
|
52
|
-
readonly auth0__token__error_ = auth0__token__error__(this.ctx)
|
|
53
|
-
readonly auth0__close = ()=>auth0__close(this.ctx)
|
|
54
|
-
readonly onMount = async (root:HTMLElement)=>{
|
|
55
|
-
if (has_dom) {
|
|
56
|
-
const unsubscribe =
|
|
57
|
-
this.auth0__opened__class.subscribe(()=>this.forms__clear__schedule(root))
|
|
58
|
-
onDestroy(unsubscribe)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
readonly login = async (data:auth0__login_data_T, forms__clear__schedule = ()=>{})=>{
|
|
62
|
-
const [auth0_token, response] = await auth0__oauth_token__fetch_post(
|
|
63
|
-
this.ctx, this.auth0__login__password_realm__body_(data)
|
|
64
|
-
)
|
|
65
|
-
if (response.ok) {
|
|
66
|
-
const auth0_token_json = JSON.stringify(auth0_token)
|
|
67
|
-
this.auth0__token__json_.$ = auth0_token_json
|
|
68
|
-
forms__clear__schedule()
|
|
69
|
-
this.auth0__close()
|
|
70
|
-
} else {
|
|
71
|
-
const auth_token_error = auth0_token as Auth0Error
|
|
72
|
-
this.auth0__token__error_.$ = auth_token_error
|
|
73
|
-
auth0__token__error__logout(this.ctx, auth_token_error)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
readonly signup = async (data:auth0__signup_data_T, forms__clear__schedule = ()=>{})=>{
|
|
77
|
-
const [auth0_userinfo] = await auth0__dbconnections_signup__fetch_get(
|
|
78
|
-
this.ctx,
|
|
79
|
-
this.auth0__signup__password_realm__body_(data))
|
|
80
|
-
const auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error
|
|
81
|
-
const { statusCode } = auth0_userinfo_Auth0Error
|
|
82
|
-
if (statusCode) {
|
|
83
|
-
const {
|
|
84
|
-
code,
|
|
85
|
-
description
|
|
86
|
-
} = auth0_userinfo_Auth0Error
|
|
87
|
-
const email =
|
|
88
|
-
code === 'user_exists'
|
|
89
|
-
? 'This Email is already signed up'
|
|
90
|
-
: description || ''
|
|
91
|
-
const auth0_token_error = { email }
|
|
92
|
-
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
93
|
-
return
|
|
94
|
-
}
|
|
95
|
-
forms__clear__schedule()
|
|
96
|
-
await this.login({
|
|
97
|
-
username: data.email,
|
|
98
|
-
password: data.password,
|
|
99
|
-
}, forms__clear__schedule)
|
|
100
|
-
}
|
|
101
|
-
readonly change_password = async (form:{ password:string }, forms__clear__schedule = ()=>{})=>{
|
|
102
|
-
const { password } = form
|
|
103
|
-
let error
|
|
104
|
-
try {
|
|
105
|
-
const [response_json, response] = await auth0__change_password__fetch_post(this.ctx, password)
|
|
106
|
-
if (!response.ok) {
|
|
107
|
-
if (response.status == 401) {
|
|
108
|
-
auth0__login__open(this.ctx)
|
|
109
|
-
const auth0_token_error = { username: 'Authentication Error - Log in' }
|
|
110
|
-
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
111
|
-
return
|
|
112
|
-
}
|
|
113
|
-
error = response_json.error || 'Error changing Password'
|
|
114
|
-
}
|
|
115
|
-
} catch (e:any) {
|
|
116
|
-
console.warn(e)
|
|
117
|
-
error = e.message
|
|
118
|
-
}
|
|
119
|
-
if (error) {
|
|
120
|
-
const auth0_token_error = { password: error }
|
|
121
|
-
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
122
|
-
return
|
|
123
|
-
}
|
|
124
|
-
forms__clear__schedule()
|
|
125
|
-
this.auth0__close()
|
|
126
|
-
}
|
|
127
|
-
readonly forms__clear__schedule_:(root:HTMLElement)=>void = (root:HTMLElement)=>{
|
|
128
|
-
return ()=>this.forms__clear__schedule(root)
|
|
129
|
-
}
|
|
130
|
-
readonly forms__clear__schedule = (root:HTMLElement)=>{
|
|
131
|
-
setTimeout(()=>{
|
|
132
|
-
auth0__token__error__clear(this.ctx)
|
|
133
|
-
inputs__clear(dom_a_('input[type=text]', root))
|
|
134
|
-
inputs__clear(dom_a_('input[type=password]', root))
|
|
135
|
-
}, 100)
|
|
136
|
-
}
|
|
137
|
-
readonly signup__onsubmit = async (event:Event, ctx:signup__onsubmit__o_T, forms__clear__schedule = ()=>{})=>{
|
|
138
|
-
event.preventDefault()
|
|
139
|
-
const {
|
|
140
|
-
email_input,
|
|
141
|
-
password_input,
|
|
142
|
-
password_confirmation_input,
|
|
143
|
-
} = ctx
|
|
144
|
-
const email = email_input.value
|
|
145
|
-
const password = password_input.value
|
|
146
|
-
const password_confirmation = password_confirmation_input.value
|
|
147
|
-
const auth0_token_error =
|
|
148
|
-
auth0__signup__validate({
|
|
149
|
-
email,
|
|
150
|
-
password,
|
|
151
|
-
password_confirmation
|
|
152
|
-
})
|
|
153
|
-
if (auth0_token_error) {
|
|
154
|
-
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
155
|
-
return false
|
|
156
|
-
}
|
|
157
|
-
await this.signup({
|
|
158
|
-
email,
|
|
159
|
-
password
|
|
160
|
-
}, forms__clear__schedule)
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
readonly login__onsubmit = async (event:Event, ctx:login__onsubmit__o_T, forms__clear__schedule = ()=>{})=>{
|
|
164
|
-
event.preventDefault()
|
|
165
|
-
const { username_login_input, password_login_input } = ctx
|
|
166
|
-
const username = username_login_input.value
|
|
167
|
-
const password = password_login_input.value
|
|
168
|
-
await this.login({ username, password }, forms__clear__schedule)
|
|
169
|
-
}
|
|
170
|
-
readonly forgot_password__onsubmit = async (event:Event, ctx:forgot_password__onsubmit__o_T)=>{
|
|
171
|
-
event.preventDefault()
|
|
172
|
-
const { email_input } = ctx
|
|
173
|
-
const email = email_input.value
|
|
174
|
-
const data:auth0__passwordless_start__fetch__optional_body_T = {
|
|
175
|
-
connection: 'email',
|
|
176
|
-
send: 'link',
|
|
177
|
-
email
|
|
178
|
-
}
|
|
179
|
-
const auth0_token_error = auth0__forgot_password__validate(data)
|
|
180
|
-
if (auth0_token_error) {
|
|
181
|
-
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
182
|
-
return
|
|
183
|
-
}
|
|
184
|
-
await auth0__passwordless_start__fetch_post(
|
|
185
|
-
this.ctx, this.auth0__login__body_(data) as auth0__passwordless_start__fetch__body_T
|
|
186
|
-
)
|
|
187
|
-
auth0__forgot_password__check_email__open(this.ctx)
|
|
188
|
-
}
|
|
189
|
-
readonly change_password__onsubmit = async (
|
|
190
|
-
event:Event, ctx:change_password__onsubmit__o_T, forms__clear__schedule = noop
|
|
191
|
-
)=>{
|
|
192
|
-
event.preventDefault()
|
|
193
|
-
const {
|
|
194
|
-
password_input,
|
|
195
|
-
password_confirmation_input,
|
|
196
|
-
} = ctx
|
|
197
|
-
const password = password_input.value
|
|
198
|
-
const password_confirmation = password_confirmation_input.value
|
|
199
|
-
const auth0_token_error =
|
|
200
|
-
auth0__change_password__validate(
|
|
201
|
-
{
|
|
202
|
-
password,
|
|
203
|
-
password_confirmation
|
|
204
|
-
})
|
|
205
|
-
if (auth0_token_error) {
|
|
206
|
-
auth0__token__error__logout(this.ctx, auth0_token_error)
|
|
207
|
-
throw auth0_token_error
|
|
208
|
-
}
|
|
209
|
-
return await this.change_password({ password }, forms__clear__schedule)
|
|
210
|
-
}
|
|
211
|
-
readonly onclose = async (event:MouseEvent)=>{
|
|
212
|
-
event.preventDefault()
|
|
213
|
-
this.auth0__close()
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function inputs__clear(inputs:NodeList) {
|
|
217
|
-
for (let i = 0; i < inputs.length; i++) {
|
|
218
|
-
const input = inputs[i] as HTMLInputElement
|
|
219
|
-
input.value = ''
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
export interface signup__password_realm__body_T
|
|
223
|
-
extends auth0__signup_data_T,
|
|
224
|
-
auth0__client_id__body_T,
|
|
225
|
-
auth0__passwordless_start__fetch__body_T,
|
|
226
|
-
password_realm__body_T,
|
|
227
|
-
auth0__grant_type__body_T,
|
|
228
|
-
auth0__oauth_token__fetch__body_T {}
|
|
229
|
-
export interface login__password_realm__body_T
|
|
230
|
-
extends auth0__login_data_T,
|
|
231
|
-
auth0__client_id__body_T,
|
|
232
|
-
auth0__passwordless_start__fetch__body_T,
|
|
233
|
-
password_realm__body_T,
|
|
234
|
-
auth0__grant_type__body_T,
|
|
235
|
-
auth0__oauth_token__fetch__body_T {}
|
|
236
|
-
export interface change_password__onsubmit__o_T {
|
|
237
|
-
password_input:HTMLInputElement
|
|
238
|
-
password_confirmation_input:HTMLInputElement
|
|
239
|
-
}
|
|
240
|
-
export interface forgot_password__onsubmit__o_T {
|
|
241
|
-
email_input:HTMLInputElement
|
|
242
|
-
}
|
|
243
|
-
export interface login__onsubmit__o_T {
|
|
244
|
-
username_login_input:HTMLInputElement
|
|
245
|
-
password_login_input:HTMLInputElement
|
|
246
|
-
}
|
|
247
|
-
export interface signup__onsubmit__o_T {
|
|
248
|
-
email_input:HTMLInputElement
|
|
249
|
-
password_input:HTMLInputElement
|
|
250
|
-
password_confirmation_input:HTMLInputElement
|
|
251
|
-
}
|
package/src/ui/index.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import 'svelte'
|
|
2
|
-
export * as Auth0 from './Auth0.svelte'
|
|
3
|
-
export * as Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
4
|
-
export * as Auth0_Change_Password_Form from './Auth0_Change_Password_Form.svelte'
|
|
5
|
-
export * as Auth0_Forgot_Password_Check_Email_Form from './Auth0_Forgot_Password_Check_Email_Form.svelte'
|
|
6
|
-
export * as Auth0_Forgot_Password_Form from './Auth0_Forgot_Password_Form.svelte'
|
|
7
|
-
export * as Auth0_Login_Form from './Auth0_Login_Form.svelte'
|
|
8
|
-
export * as Auth0_Signup_Form from './Auth0_Signup_Form.svelte'
|
package/svelte.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import adapter from '@sveltejs/adapter-auto'
|
|
2
|
-
import preprocess from 'svelte-preprocess'
|
|
3
|
-
/** @type {import('@sveltejs/kit').Config} */
|
|
4
|
-
const config = {
|
|
5
|
-
// Consult https://github.com/sveltejs/svelte-preprocess
|
|
6
|
-
// for more information about preprocessors
|
|
7
|
-
preprocess: preprocess(),
|
|
8
|
-
kit: {
|
|
9
|
-
adapter: adapter(),
|
|
10
|
-
package: {
|
|
11
|
-
dir: 'lib',
|
|
12
|
-
emitTypes: false
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export default config
|