pwa-auth 3.6.0 → 3.7.1
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/README.md +140 -485
- package/base/export/drawer.d.ts +2 -0
- package/base/export/drawer.d.ts.map +1 -0
- package/base/export/drawer.js +2 -0
- package/base/export/drawer.js.map +1 -0
- package/base/export/icon.d.ts +2 -0
- package/base/export/icon.d.ts.map +1 -0
- package/base/export/icon.js +2 -0
- package/base/export/icon.js.map +1 -0
- package/base/export/login.d.ts +2 -0
- package/base/export/login.d.ts.map +1 -0
- package/base/export/login.js +2 -0
- package/base/export/login.js.map +1 -0
- package/base/export/reset.d.ts +2 -0
- package/base/export/reset.d.ts.map +1 -0
- package/base/export/reset.js +2 -0
- package/base/export/reset.js.map +1 -0
- package/base/export/settings.d.ts +2 -0
- package/base/export/settings.d.ts.map +1 -0
- package/base/export/settings.js +2 -0
- package/base/export/settings.js.map +1 -0
- package/base/webcomponents/css/animation.d.ts.map +1 -1
- package/base/webcomponents/css/animation.js +35 -63
- package/base/webcomponents/css/animation.js.map +1 -1
- package/base/webcomponents/drawer/css/drawer.d.ts.map +1 -1
- package/base/webcomponents/drawer/css/drawer.js +12 -14
- package/base/webcomponents/drawer/css/drawer.js.map +1 -1
- package/base/webcomponents/drawer/css/exit.js +1 -1
- package/base/webcomponents/drawer/css/paragraph.d.ts.map +1 -1
- package/base/webcomponents/drawer/css/paragraph.js +10 -3
- package/base/webcomponents/drawer/css/paragraph.js.map +1 -1
- package/base/webcomponents/drawer/drawer.d.ts +25 -0
- package/base/webcomponents/drawer/drawer.d.ts.map +1 -1
- package/base/webcomponents/drawer/drawer.js +298 -17
- package/base/webcomponents/drawer/drawer.js.map +1 -1
- package/base/webcomponents/form/css/button.d.ts.map +1 -1
- package/base/webcomponents/form/css/button.js +15 -16
- package/base/webcomponents/form/css/button.js.map +1 -1
- package/base/webcomponents/form/css/input.d.ts.map +1 -1
- package/base/webcomponents/form/css/input.js +10 -1
- package/base/webcomponents/form/css/input.js.map +1 -1
- package/base/webcomponents/form/css/label.d.ts.map +1 -1
- package/base/webcomponents/form/css/label.js +19 -1
- package/base/webcomponents/form/css/label.js.map +1 -1
- package/base/webcomponents/form/css/list.d.ts.map +1 -1
- package/base/webcomponents/form/css/list.js +2 -1
- package/base/webcomponents/form/css/list.js.map +1 -1
- package/base/webcomponents/form/css/notice.js +3 -3
- package/base/webcomponents/form/css/status.d.ts.map +1 -1
- package/base/webcomponents/form/css/status.js +18 -5
- package/base/webcomponents/form/css/status.js.map +1 -1
- package/base/webcomponents/form/css/toggle.d.ts.map +1 -1
- package/base/webcomponents/form/css/toggle.js +7 -0
- package/base/webcomponents/form/css/toggle.js.map +1 -1
- package/base/webcomponents/form/forgot.d.ts.map +1 -1
- package/base/webcomponents/form/forgot.js +5 -4
- package/base/webcomponents/form/forgot.js.map +1 -1
- package/base/webcomponents/form/login.js +1 -1
- package/base/webcomponents/form/signup.js +1 -1
- package/base/webcomponents/icon/css/icon.d.ts.map +1 -1
- package/base/webcomponents/icon/css/icon.js +9 -0
- package/base/webcomponents/icon/css/icon.js.map +1 -1
- package/base/webcomponents/login/css/auth.d.ts.map +1 -1
- package/base/webcomponents/login/css/auth.js +9 -4
- package/base/webcomponents/login/css/auth.js.map +1 -1
- package/base/webcomponents/login/page.d.ts +20 -1
- package/base/webcomponents/login/page.d.ts.map +1 -1
- package/base/webcomponents/login/page.js +182 -6
- package/base/webcomponents/login/page.js.map +1 -1
- package/base/webcomponents/settings/css/navigation.js +3 -3
- package/base/webcomponents/settings/input/delete.d.ts.map +1 -1
- package/base/webcomponents/settings/input/delete.js +7 -1
- package/base/webcomponents/settings/input/delete.js.map +1 -1
- package/base/webcomponents/settings/input/uploader.d.ts.map +1 -1
- package/base/webcomponents/settings/input/uploader.js +8 -4
- package/base/webcomponents/settings/input/uploader.js.map +1 -1
- package/base/webcomponents/settings/input/verify.d.ts.map +1 -1
- package/base/webcomponents/settings/input/verify.js +24 -7
- package/base/webcomponents/settings/input/verify.js.map +1 -1
- package/base/webcomponents/settings/settings.d.ts +19 -1
- package/base/webcomponents/settings/settings.d.ts.map +1 -1
- package/base/webcomponents/settings/settings.js +177 -12
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/docs/drawer-slide.md +206 -0
- package/docs/sliders.md +38 -31
- package/package.json +48 -10
- package/source/pwa-auth.js +408 -267
- package/source/pwa-styles.css +0 -8
- package/firebase.md +0 -125
- package/intro.md +0 -19
package/source/pwa-styles.css
CHANGED
|
@@ -18,24 +18,19 @@
|
|
|
18
18
|
--pwa_icon_diameter: 44px; /* sync to --pwa_icon_height */
|
|
19
19
|
|
|
20
20
|
/* <user-drawer> */
|
|
21
|
-
--pwa_drawer_position: absolute;
|
|
22
21
|
--pwa_drawer_border: 0;
|
|
23
22
|
--pwa_drawer_z-index: 3;
|
|
24
23
|
--pwa_drawer_border-radius: 0 0 18px 18px;
|
|
25
24
|
--pwa_drawer_text_color: #1c2430;
|
|
26
|
-
--pwa_drawer_background_color: #fffdf8;
|
|
27
25
|
|
|
28
26
|
/* <user-settings> */
|
|
29
|
-
--pwa_settings_background_color: #fffdf8;
|
|
30
27
|
--pwa_divider_color: #e3daca;
|
|
31
28
|
--pwa_nav_button_color: #4e5b6a;
|
|
32
29
|
--pwa_nav_highlight_color: #1c2430;
|
|
33
|
-
--pwa_nav_on_background: #f3efe6;
|
|
34
30
|
--pwa_header_color: #1c2430;
|
|
35
31
|
|
|
36
32
|
/* fields */
|
|
37
33
|
--pwa_label_text_color: #1c2430;
|
|
38
|
-
--pwa_input_background_color: #f3efe6;
|
|
39
34
|
--pwa_line_color: #e3daca;
|
|
40
35
|
|
|
41
36
|
/* buttons */
|
|
@@ -44,7 +39,4 @@
|
|
|
44
39
|
--pwa_action_border_color: #214f34;
|
|
45
40
|
--pwa_close_color: #9a3b32;
|
|
46
41
|
|
|
47
|
-
/* <user-login> */
|
|
48
|
-
--section_background_color: #fffdf8;
|
|
49
|
-
|
|
50
42
|
}
|
package/firebase.md
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
# Firebase
|
|
2
|
-
|
|
3
|
-
## Project
|
|
4
|
-
|
|
5
|
-
- Firebase Authentication with email and password
|
|
6
|
-
- Google sign-in, if you leave Continue with Google on (the default)
|
|
7
|
-
- Cloud Storage bucket
|
|
8
|
-
- Google Analytics, if you call `logAccount` or `logAccountDelete`
|
|
9
|
-
|
|
10
|
-
## Storage rules
|
|
11
|
-
|
|
12
|
-
Storage rules must allow the signed-in user to read and write only `pwa-auth/{uid}/**`.
|
|
13
|
-
|
|
14
|
-
## Firestore rules
|
|
15
|
-
|
|
16
|
-
Firestore rules allow `users/{uid}` and `contractors/{uid}`, and any other document `deleteDocument` removes, only when the signed-in uid is the document id or the `owner` field. Everything else is denied. The host owns those documents. See [Data ownership](README.md#data-ownership).
|
|
17
|
-
|
|
18
|
-
## FIREBASE_CONFIG
|
|
19
|
-
|
|
20
|
-
Required. Call `initialize({ config })`, or set `window.process.env.FIREBASE_CONFIG` in a classic script before the module runs. One assignment. A second `window.process = …` replaces the first and drops keys you already set.
|
|
21
|
-
|
|
22
|
-
```html
|
|
23
|
-
<script>
|
|
24
|
-
window.process = { env: { FIREBASE_CONFIG: JSON.stringify({
|
|
25
|
-
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
26
|
-
authDomain: "xxxxxxx.xxxxxxx.xxx",
|
|
27
|
-
databaseURL: "https://xxxxxxx.xxxxxxx.xxx",
|
|
28
|
-
projectId: "xxxxxxx",
|
|
29
|
-
storageBucket: "xxxxxxx.xxxxxxx.xxx",
|
|
30
|
-
messagingSenderId: "xxxxxxxxxxx",
|
|
31
|
-
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
32
|
-
measurementId: "xxxxxxxxxxx"
|
|
33
|
-
}) } };
|
|
34
|
-
</script>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
`authentication.ts` reads `process.env.FIREBASE_CONFIG` when `apiKey` is present and calls `initialize`. An empty config does not throw. Call `initialize` instead.
|
|
38
|
-
|
|
39
|
-
## initialize
|
|
40
|
-
|
|
41
|
-
```javascript
|
|
42
|
-
import { initialize } from 'pwa-auth';
|
|
43
|
-
import { getApp } from 'firebase/app';
|
|
44
|
-
|
|
45
|
-
// Optional - your config
|
|
46
|
-
initialize({
|
|
47
|
-
config: {
|
|
48
|
-
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
49
|
-
authDomain: "xxxxxxx.xxxxxxx.xxx",
|
|
50
|
-
projectId: "xxxxxxx",
|
|
51
|
-
storageBucket: "xxxxxxx.xxxxxxx.xxx",
|
|
52
|
-
messagingSenderId: "xxxxxxxxxxx",
|
|
53
|
-
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Optional - an app you already created. Omit FIREBASE_CONFIG when you do this.
|
|
58
|
-
initialize({ app: getApp() });
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
| Export | |
|
|
62
|
-
|---|---|
|
|
63
|
-
| `initialize({ app, config, actionCodeSettings })` | Boot Firebase. `app` is a host app. `config` is a host config. `actionCodeSettings` is optional and is passed to the verification email. The legacy `FIREBASE_CONFIG` script still works. |
|
|
64
|
-
|
|
65
|
-
## firebase-config attribute
|
|
66
|
-
|
|
67
|
-
Optional. A tag can carry the same JSON. The first element to connect wins, and only when the app is not up yet.
|
|
68
|
-
|
|
69
|
-
```html
|
|
70
|
-
<user-icon firebase-config='{"apiKey":"...","authDomain":"...","projectId":"..."}'></user-icon>
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
The first `initialize` wins. A later call with a different app throws.
|
|
74
|
-
|
|
75
|
-
## actionCodeSettings
|
|
76
|
-
|
|
77
|
-
Optional. `actionCodeSettings` is passed to `sendEmailVerification`. Put the continue URL in `url`. A later `initialize({ actionCodeSettings })` still stores it after the app is up.
|
|
78
|
-
|
|
79
|
-
```javascript
|
|
80
|
-
initialize({
|
|
81
|
-
config,
|
|
82
|
-
actionCodeSettings: { url: 'https://example.com/continue' }
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Auth, Firestore, and Storage
|
|
87
|
-
|
|
88
|
-
| Export | |
|
|
89
|
-
|---|---|
|
|
90
|
-
| `auth` | Firebase Auth for this app. Read `auth.currentUser` at call time. |
|
|
91
|
-
| `db` | Firestore. |
|
|
92
|
-
| `storage` | Cloud Storage. |
|
|
93
|
-
| `application` | The Firebase app from `initialize` or from `FIREBASE_CONFIG`. |
|
|
94
|
-
| `firebaseConfig` | The parsed config object. |
|
|
95
|
-
|
|
96
|
-
## Password
|
|
97
|
-
|
|
98
|
-
Firebase Auth's own minimum is 6 characters. Sign-up and a password change in `<user-settings>` ask for 8 to 128. Spaces and other characters are allowed. There is no requirement for a number or a symbol. The sentence under the field is "At least 8 characters. A passphrase works well." A short password reads "Use at least 8 characters."
|
|
99
|
-
|
|
100
|
-
In the Firebase console, open Authentication and turn on the password policy. Set the minimum to 8 so the server uses the same rule. This package does not change that policy.
|
|
101
|
-
|
|
102
|
-
## Google sign-in
|
|
103
|
-
|
|
104
|
-
Continue with Google uses Firebase `signInWithPopup`. A blocked popup, or a phone, uses `signInWithRedirect`. The first success creates the Firebase user.
|
|
105
|
-
|
|
106
|
-
On [pwa-authentic.firebaseapp.com](https://pwa-authentic.firebaseapp.com) the redirect works, because that host is Firebase Hosting and `authDomain` is the same site. A host on another domain should keep the popup. Redirect there needs the [Firebase redirect guidance](https://firebase.google.com/docs/auth/web/redirect-best-practices): `authDomain` must be that site, or the sign-in must be proxied through Firebase Hosting. Browsers block the third-party storage the redirect handler uses.
|
|
107
|
-
|
|
108
|
-
Enable Google in the Firebase console:
|
|
109
|
-
|
|
110
|
-
1. Open the project. Go to Build, Authentication.
|
|
111
|
-
2. Open Sign-in method.
|
|
112
|
-
3. Choose Google. Turn on Enable.
|
|
113
|
-
4. Set a public-facing support email. Save.
|
|
114
|
-
5. Open Settings, then Authorized domains.
|
|
115
|
-
6. `localhost` and your `firebaseapp.com` / `web.app` domains are already there. Add every other domain that embeds the component. Save.
|
|
116
|
-
|
|
117
|
-
`hide-google` on `<user-login>` or `<user-drawer>` removes the button.
|
|
118
|
-
|
|
119
|
-
## Emulators
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
npm run test:emulator # Auth, Firestore, and Storage emulators, then the browser checks
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
`npm run test:emulator` uses `firebase-tools` 14.24.0. Firestore and Storage need Java 21 or newer on `PATH`.
|
package/intro.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# A short introduction
|
|
2
|
-
|
|
3
|
-
## What it is
|
|
4
|
-
|
|
5
|
-
pwa-auth is the sign-in for your website. It stays on your site, in your own look. People use an email address and a password. There is one sign-in for the whole page.
|
|
6
|
-
|
|
7
|
-
## What it does for you
|
|
8
|
-
|
|
9
|
-
Your visitors see a button. Before they sign in it says Login, or Subscribe if you prefer that word. After they sign in it shows their photo.
|
|
10
|
-
|
|
11
|
-
A panel drops down from the top. They can create an account or sign in, or continue with Google in one click. Once they are in, they see their name, a link to their settings, and a way to log out.
|
|
12
|
-
|
|
13
|
-
In settings they can change their photo, name, email, and password, or delete the account. Creating an account sends a verification email. They can still sign in before they open that email.
|
|
14
|
-
|
|
15
|
-
They look after that sign-in themselves. Your site keeps the records it creates. This sign-in does not write those records, and deleting an account does not remove them. The files stored for that sign-in are removed with the account.
|
|
16
|
-
|
|
17
|
-
## How to get started
|
|
18
|
-
|
|
19
|
-
The person who adds this to your site follows the [Quick start](README.md#quick-start). There is also a [live demo](https://pwa-authentic.firebaseapp.com).
|