@things-factory/auth-ui 8.0.38 → 9.0.0-9.0.0-beta.59.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.
Files changed (142) hide show
  1. package/dist-client/components/abstract-auth-page.d.ts +1 -1
  2. package/dist-client/components/abstract-auth-page.js +2 -0
  3. package/dist-client/components/abstract-auth-page.js.map +1 -1
  4. package/dist-client/components/abstract-password-reset.d.ts +2 -2
  5. package/dist-client/components/abstract-password-reset.js +5 -5
  6. package/dist-client/components/abstract-password-reset.js.map +1 -1
  7. package/dist-client/components/change-password.js +1 -1
  8. package/dist-client/components/change-password.js.map +1 -1
  9. package/dist-client/components/invite-user.d.ts +1 -1
  10. package/dist-client/components/invite-user.js +1 -2
  11. package/dist-client/components/invite-user.js.map +1 -1
  12. package/dist-client/components/partner-role-editor.js +1 -1
  13. package/dist-client/components/partner-role-editor.js.map +1 -1
  14. package/dist-client/components/profile-component.d.ts +3 -3
  15. package/dist-client/components/profile-component.js +3 -3
  16. package/dist-client/components/profile-component.js.map +1 -1
  17. package/dist-client/components/role-privilege-editor.js +2 -1
  18. package/dist-client/components/role-privilege-editor.js.map +1 -1
  19. package/dist-client/components/user-role-editor.d.ts +2 -2
  20. package/dist-client/components/user-role-editor.js +2 -2
  21. package/dist-client/components/user-role-editor.js.map +1 -1
  22. package/dist-client/constants/index.d.ts +1 -1
  23. package/dist-client/constants/index.js +1 -1
  24. package/dist-client/constants/index.js.map +1 -1
  25. package/dist-client/entries/auth/activate.d.ts +1 -1
  26. package/dist-client/entries/auth/activate.js +1 -1
  27. package/dist-client/entries/auth/activate.js.map +1 -1
  28. package/dist-client/entries/auth/checkin.js +2 -2
  29. package/dist-client/entries/auth/checkin.js.map +1 -1
  30. package/dist-client/entries/auth/forgot-password.d.ts +2 -2
  31. package/dist-client/entries/auth/forgot-password.js +11 -3
  32. package/dist-client/entries/auth/forgot-password.js.map +1 -1
  33. package/dist-client/entries/auth/reset-password.d.ts +1 -1
  34. package/dist-client/entries/auth/reset-password.js +1 -1
  35. package/dist-client/entries/auth/reset-password.js.map +1 -1
  36. package/dist-client/entries/auth/result.d.ts +1 -1
  37. package/dist-client/entries/auth/result.js +1 -1
  38. package/dist-client/entries/auth/result.js.map +1 -1
  39. package/dist-client/entries/auth/signin.d.ts +1 -1
  40. package/dist-client/entries/auth/signin.js +1 -1
  41. package/dist-client/entries/auth/signin.js.map +1 -1
  42. package/dist-client/entries/auth/signup.d.ts +3 -1
  43. package/dist-client/entries/auth/signup.js +32 -2
  44. package/dist-client/entries/auth/signup.js.map +1 -1
  45. package/dist-client/entries/auth/unlock-user.d.ts +1 -1
  46. package/dist-client/entries/auth/unlock-user.js +1 -1
  47. package/dist-client/entries/auth/unlock-user.js.map +1 -1
  48. package/dist-client/entries/oauth2/oauth2-decision-page.d.ts +1 -1
  49. package/dist-client/entries/oauth2/oauth2-decision-page.js +1 -1
  50. package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
  51. package/dist-client/entries/public/home.js +2 -2
  52. package/dist-client/entries/public/home.js.map +1 -1
  53. package/dist-client/pages/application/application.js +1 -1
  54. package/dist-client/pages/application/application.js.map +1 -1
  55. package/dist-client/pages/domain/domain-management.d.ts +1 -1
  56. package/dist-client/pages/domain/domain-management.js +1 -1
  57. package/dist-client/pages/domain/domain-management.js.map +1 -1
  58. package/dist-client/pages/domain-link/domain-link-management.d.ts +53 -0
  59. package/dist-client/pages/domain-link/domain-link-management.js +353 -0
  60. package/dist-client/pages/domain-link/domain-link-management.js.map +1 -0
  61. package/dist-client/pages/partner/partner-management.d.ts +3 -3
  62. package/dist-client/pages/partner/partner-management.js +3 -3
  63. package/dist-client/pages/partner/partner-management.js.map +1 -1
  64. package/dist-client/pages/profile.d.ts +1 -1
  65. package/dist-client/pages/profile.js +1 -1
  66. package/dist-client/pages/profile.js.map +1 -1
  67. package/dist-client/pages/role/role-management.d.ts +3 -3
  68. package/dist-client/pages/role/role-management.js +3 -3
  69. package/dist-client/pages/role/role-management.js.map +1 -1
  70. package/dist-client/pages/user/user-management.d.ts +4 -4
  71. package/dist-client/pages/user/user-management.js +4 -4
  72. package/dist-client/pages/user/user-management.js.map +1 -1
  73. package/dist-client/route.js +3 -0
  74. package/dist-client/route.js.map +1 -1
  75. package/dist-client/tsconfig.tsbuildinfo +1 -1
  76. package/dist-server/tsconfig.tsbuildinfo +1 -1
  77. package/helps/auth/domain-link.md +178 -0
  78. package/package.json +12 -12
  79. package/things-factory.config.js +2 -1
  80. package/translations/en.json +7 -0
  81. package/translations/ja.json +7 -0
  82. package/translations/ko.json +7 -0
  83. package/translations/ms.json +7 -0
  84. package/translations/zh.json +7 -0
  85. package/client/auth-style-sign.ts +0 -194
  86. package/client/bootstrap.ts +0 -55
  87. package/client/components/abstract-auth-page.ts +0 -301
  88. package/client/components/abstract-password-reset.ts +0 -163
  89. package/client/components/abstract-sign.ts +0 -127
  90. package/client/components/change-password.ts +0 -153
  91. package/client/components/contact-us.ts +0 -116
  92. package/client/components/create-domain-popup.ts +0 -141
  93. package/client/components/create-role.ts +0 -123
  94. package/client/components/create-user.ts +0 -117
  95. package/client/components/credential-manager.ts +0 -64
  96. package/client/components/delete-user-popup.ts +0 -117
  97. package/client/components/domain-switch.ts +0 -127
  98. package/client/components/invite-customer.ts +0 -104
  99. package/client/components/invite-user.ts +0 -104
  100. package/client/components/my-login-history.ts +0 -101
  101. package/client/components/ownership-transfer-popup.ts +0 -110
  102. package/client/components/partner-info-card.ts +0 -89
  103. package/client/components/partner-role-editor.ts +0 -153
  104. package/client/components/profile-component.ts +0 -392
  105. package/client/components/role-edit-form.ts +0 -92
  106. package/client/components/role-privilege-editor.ts +0 -267
  107. package/client/components/role-selector.ts +0 -102
  108. package/client/components/user-role-editor.ts +0 -499
  109. package/client/constants/application.ts +0 -9
  110. package/client/constants/index.ts +0 -1
  111. package/client/entries/auth/activate.ts +0 -272
  112. package/client/entries/auth/checkin.ts +0 -183
  113. package/client/entries/auth/forgot-password.ts +0 -104
  114. package/client/entries/auth/reset-password.ts +0 -22
  115. package/client/entries/auth/result.ts +0 -193
  116. package/client/entries/auth/signin.ts +0 -18
  117. package/client/entries/auth/signup.ts +0 -115
  118. package/client/entries/auth/unlock-user.ts +0 -22
  119. package/client/entries/oauth2/oauth2-decision-error-page.ts +0 -50
  120. package/client/entries/oauth2/oauth2-decision-page.ts +0 -196
  121. package/client/entries/public/home.ts +0 -246
  122. package/client/index.ts +0 -124
  123. package/client/pages/app-binding/app-binding.ts +0 -423
  124. package/client/pages/app-binding/app-bindings.ts +0 -171
  125. package/client/pages/appliance/appliance.ts +0 -452
  126. package/client/pages/appliance/home.ts +0 -177
  127. package/client/pages/appliance/register.ts +0 -183
  128. package/client/pages/application/application.ts +0 -428
  129. package/client/pages/application/applications.ts +0 -182
  130. package/client/pages/application/register.ts +0 -211
  131. package/client/pages/attribute/attribute-set-item-list.ts +0 -237
  132. package/client/pages/attribute/attribute-set-management.ts +0 -282
  133. package/client/pages/auth-provider/auth-provider-management.ts +0 -381
  134. package/client/pages/domain/domain-management.ts +0 -431
  135. package/client/pages/partner/partner-management.ts +0 -112
  136. package/client/pages/profile.ts +0 -32
  137. package/client/pages/role/role-management.ts +0 -134
  138. package/client/pages/user/user-management.ts +0 -223
  139. package/client/route.ts +0 -67
  140. package/client/themes/auth-theme.css +0 -65
  141. package/client/utils/password-rule.ts +0 -37
  142. package/server/index.ts +0 -0
@@ -1,194 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const AUTH_STYLE_SIGN = css`
4
- :host {
5
- display: flex;
6
- background-color: var(--md-sys-color-primary);
7
- color: var(--md-sys-color-on-primary);
8
-
9
- --md-filled-text-field-supporting-text-color: var(--md-sys-color-on-primary);
10
- }
11
-
12
- :host *:focus {
13
- outline: none;
14
- }
15
-
16
- :host * {
17
- box-sizing: border-box;
18
- }
19
-
20
- .wrap {
21
- display: block;
22
- width: 450px;
23
- min-width: 350px;
24
- margin: 0 auto;
25
- padding-bottom: 100px;
26
- text-align: center;
27
- }
28
-
29
- .auth-brand {
30
- color: var(--md-sys-color-on-primary);
31
- }
32
-
33
- .auth-brand img {
34
- margin: 15% auto 5px auto;
35
- width: 100px;
36
- border: 3px solid var(--md-sys-color-on-primary);
37
- border-radius: 25px;
38
- box-shadow: var(--box-shadow);
39
- }
40
- .name {
41
- display: block;
42
- font: var(--auth-brand-name);
43
- text-shadow: var(--auth-brand-name-shadow);
44
- }
45
- .auth-brand .welcome-msg {
46
- font: var(--auth-brand-welcome-msg);
47
- }
48
- .auth-form {
49
- display: grid;
50
- grid-gap: var(--spacing-medium);
51
- grid-template-columns: 1fr 1fr;
52
- }
53
-
54
- form {
55
- grid-column: 1 / -1;
56
- display: grid;
57
- grid-template-columns: 1fr 1fr;
58
- grid-gap: var(--spacing-medium);
59
- align-items: center;
60
- }
61
-
62
- h3 {
63
- grid-column: 1 / -1;
64
- margin: 50px 0 0 0;
65
- font: var(--auth-title-font);
66
- color: var(--auth-title-color, var(--md-sys-color-on-primary));
67
- text-transform: uppercase;
68
- }
69
-
70
- .field {
71
- grid-column: 1 / -1;
72
- text-align: left;
73
- }
74
-
75
- .submit-buttons-container {
76
- grid-column: 1 / -1;
77
- text-align: center;
78
-
79
- display: flex;
80
- align-items: center;
81
- gap: 10px;
82
- }
83
-
84
- .fingerprint {
85
- color: var(--md-sys-color-on-primary);
86
- border: 1.5px solid var(--md-sys-color-on-primary);
87
- border-radius: 20%;
88
- width: 36px;
89
- height: 36px;
90
- }
91
-
92
- .field md-filled-text-field {
93
- grid-column: 1 / -1;
94
- width: 100%;
95
- }
96
-
97
- md-text-button,
98
- md-elevated-button {
99
- grid-column: 1 / -1;
100
- flex: 1;
101
- }
102
-
103
- .wrap .link {
104
- text-decoration: none;
105
- justify-self: flex-start;
106
- }
107
-
108
- .wrap .link md-text-button {
109
- --md-text-button-label-text-color: var(--md-sys-color-on-primary);
110
- --md-text-button-focus-label-text-color: var(--md-sys-color-on-primary);
111
- --md-text-button-hover-label-text-color: var(--md-sys-color-on-primary);
112
- }
113
-
114
- .wrap .link md-icon {
115
- color: var(--md-sys-color-on-primary);
116
- }
117
-
118
- #locale-area {
119
- display: flex;
120
- grid-column: 1 / -1;
121
- padding: 0 var(--spacing-medium);
122
- }
123
-
124
- #locale-area > label {
125
- display: flex;
126
- align-items: center;
127
- color: var(--md-sys-color-on-primary);
128
- --md-icon-size: 16px;
129
- }
130
-
131
- #locale-selector {
132
- font-size: 16px;
133
- width: 100%;
134
- }
135
-
136
- #locale-selector {
137
- --i18n-selector-field-border: none;
138
- --i18n-selector-field-background-color: none;
139
- --i18n-selector-field-font-size: 14px;
140
- --i18n-selector-field-color: var(--md-sys-color-on-primary);
141
- }
142
-
143
- .lottie-container {
144
- width: 100%;
145
- height: 300px;
146
- position: absolute;
147
- left: 0;
148
- bottom: 0;
149
- pointer-events: none;
150
- }
151
- .lottie-container lottie-player {
152
- position: absolute;
153
- bottom: -6%;
154
- width: 100%;
155
- height: auto;
156
- }
157
-
158
- @media (max-width: 450px) {
159
- .wrap {
160
- width: 85%;
161
- min-width: 320px;
162
- }
163
- .auth-form {
164
- grid-template-columns: 1fr;
165
- }
166
- .auth-brand img {
167
- margin: 12% auto 5px auto;
168
- width: 75px;
169
- }
170
- h3 {
171
- margin: 15px 0 0 0;
172
- }
173
- .lottie-container {
174
- overflow: hidden;
175
- height: 200px;
176
- pointer-events: none;
177
- }
178
- .lottie-container lottie-player {
179
- width: 1200px;
180
- left: -30%;
181
- }
182
- }
183
-
184
- @media screen and (min-width: 1400px) {
185
- .wrap {
186
- padding-bottom: 150px;
187
- }
188
- }
189
- @media screen and (min-width: 2500px) {
190
- .wrap {
191
- padding-bottom: 280px;
192
- }
193
- }
194
- `
@@ -1,55 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/i18n/ox-i18n.js'
3
- import '@operato/attribute/grist-editor' /* for register data-grist editor type 'attributes' */
4
-
5
- import { html } from 'lit-html'
6
-
7
- import { navigate, store } from '@operato/shell'
8
- import { TOOL_POSITION } from '@operato/layout'
9
- import { OxGristEditorPrivilege } from '@operato/app/grist-editor/ox-grist-editor-privilege.js'
10
- import {
11
- registerEditor as registerGristEditor,
12
- registerRenderer as registerGristRenderer,
13
- OxGristRendererJson5
14
- } from '@operato/data-grist'
15
-
16
- import { auth } from '@things-factory/auth-base/dist-client/auth.js'
17
- import { ADD_MORENDA } from '@things-factory/more-base/client'
18
-
19
- export default async function bootstrap() {
20
- registerGristEditor('privilege', OxGristEditorPrivilege)
21
- registerGristRenderer('privilege', OxGristRendererJson5)
22
-
23
- /* add user profile morenda */
24
- store.dispatch({
25
- type: ADD_MORENDA,
26
- morenda: {
27
- icon: html` <md-icon>account_circle</md-icon> `,
28
- name: html` <ox-i18n msgid="text.auth profile"></ox-i18n> `,
29
- position: TOOL_POSITION.FRONT_END,
30
- action: () => {
31
- navigate('profile')
32
- }
33
- }
34
- })
35
-
36
- /* add sign-out morenda */
37
- store.dispatch({
38
- type: ADD_MORENDA,
39
- morenda: {
40
- icon: html` <md-icon>exit_to_app</md-icon> `,
41
- name: html` <ox-i18n msgid="field.sign out"></ox-i18n> `,
42
- position: TOOL_POSITION.FRONT_END,
43
- action: () => {
44
- auth.signout()
45
- }
46
- }
47
- })
48
-
49
- /*
50
- Get user profile information from server.
51
- As soon as response received, auth.on('profile', ...) handlers start to work.
52
- It's very important point to build UI for the user.
53
- */
54
- await auth.profile()
55
- }
@@ -1,301 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@material/web/button/elevated-button.js'
3
- import '@material/web/button/text-button.js'
4
- import '@material/web/textfield/filled-text-field.js'
5
-
6
- import '@operato/lottie-player'
7
- import '@operato/i18n/ox-i18n.js'
8
- import '@operato/i18n/ox-i18n-selector.js'
9
- import '@operato/layout/ox-snack-bar.js'
10
-
11
- import { css, html, LitElement, nothing } from 'lit'
12
- import { property, query, state } from 'lit/decorators.js'
13
-
14
- import { i18next, localize } from '@operato/i18n'
15
- import { ScrollbarStyles } from '@operato/styles'
16
- import { isSafari } from '@operato/utils'
17
-
18
- import { AUTH_STYLE_SIGN } from '../auth-style-sign.js'
19
-
20
- export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
21
- static styles = [
22
- ScrollbarStyles,
23
- css`
24
- :host {
25
- position: relative;
26
- overflow: hidden;
27
-
28
- display: flex;
29
- flex-direction: row;
30
-
31
- width: 100vw;
32
- height: 100vh;
33
- height: 100dvh;
34
- }
35
-
36
- .content {
37
- flex: 1;
38
- overflow: auto;
39
- }
40
-
41
- .home {
42
- position: absolute;
43
- padding: var(--padding-dufault, 9px);
44
- left: 20px;
45
- top: 10px;
46
- color: var(--md-sys-color-on-primary);
47
- }
48
-
49
- div.field {
50
- margin-bottom: var(--spacing-medium);
51
- }
52
-
53
- [hidden] {
54
- display: none;
55
- }
56
-
57
- #snackbar {
58
- width: 100%;
59
- z-index: 10;
60
- }
61
-
62
- @media print {
63
- :host {
64
- width: 100%;
65
- height: 100%;
66
- min-height: 100vh;
67
- min-height: 100dvh;
68
- }
69
- }
70
- `,
71
- AUTH_STYLE_SIGN
72
- ]
73
-
74
- @property({ type: Object }) data: any
75
- @property({ type: String }) message?: string
76
- @property({ type: Object }) detail: any
77
- @property({ type: String }) redirectTo?: string
78
-
79
- @query('#form') formEl!: HTMLFormElement
80
-
81
- private _applicationMeta?: {
82
- icon: string
83
- title: string
84
- description: string
85
- }
86
-
87
- get autocompletable() {
88
- return false
89
- }
90
-
91
- render() {
92
- const { disableUserFavoredLanguage, languages } = this.data || {}
93
- var { icon, title, description } = this.applicationMeta
94
-
95
- return html`
96
- <div class="content md-typescale-display-medium">
97
- <div class="wrap">
98
- <div class="auth-brand">
99
- <img src=${icon} />
100
- <strong class="name">${title}</strong>
101
- <span class="welcome-msg">${description}</span>
102
- </div>
103
-
104
- <div class="auth-form">
105
- <h3><ox-i18n msgid="title.${this.pageName}"></ox-i18n></h3>
106
-
107
- <form
108
- id="form"
109
- action="${this.actionUrl}"
110
- method="post"
111
- autocomplete=${this.autocompletable ? 'on' : 'off'}
112
- @keypress=${e => {
113
- if (e.key == 'Enter') this._onSubmit(e)
114
- }}
115
- >
116
- ${this.formfields}
117
- </form>
118
- ${this.links}
119
- ${!disableUserFavoredLanguage
120
- ? html` <div id="locale-area">
121
- <label for="locale-selector"><md-icon>language</md-icon></label>
122
- <ox-i18n-selector
123
- id="locale-selector"
124
- value=${i18next.language || 'en-US'}
125
- .languages=${languages}
126
- @change=${e => {
127
- var locale = e.detail
128
- if (!locale) return
129
-
130
- i18next.changeLanguage(locale)
131
- }}
132
- ></ox-i18n-selector>
133
- </div>`
134
- : nothing}
135
- </div>
136
- </div>
137
-
138
- <md-icon-button class="home" @click=${e => (window.location.href = '/')}
139
- ><md-icon>home</md-icon></md-icon-button
140
- >
141
- <ox-snack-bar id="snackbar" level="error" .message=${this.message}></ox-snack-bar>
142
-
143
- ${isSafari()
144
- ? html``
145
- : html`
146
- <div class="lottie-container">
147
- <lottie-player autoplay loop src="../../assets/images/background-animation.json"></lottie-player>
148
- </div>
149
- `}
150
- </div>
151
- `
152
- }
153
-
154
- firstUpdated() {
155
- setTimeout(() => {
156
- ;(this.renderRoot.querySelector('md-filled-text-field') as any).focus()
157
- }, 100)
158
-
159
- this.formEl.reset = () => {
160
- this.formElements.filter(el => !(el.hidden || el.type == 'hidden')).forEach(el => (el.value = ''))
161
- }
162
- }
163
-
164
- updated(changed) {
165
- if (changed.has('data') && this.data) {
166
- this.message = this.data.message
167
- this.redirectTo = this.data.redirectTo
168
- }
169
- }
170
-
171
- abstract get pageName(): string
172
- abstract get actionUrl(): string
173
-
174
- get formElements(): HTMLInputElement[] {
175
- return Array.from(this.formEl.querySelectorAll('[name]'))
176
- }
177
-
178
- get formfields() {
179
- const username = this.data?.username || ''
180
- // .validationMessage=${String(i18next.t('text.invalid-username'))}
181
-
182
- return html`
183
- <input id="redirectTo" type="hidden" name="redirectTo" .value=${this.redirectTo || '/'} />
184
-
185
- <div class="field">
186
- <md-filled-text-field
187
- name="username"
188
- type="text"
189
- label=${String(i18next.t('field.user-id or email'))}
190
- required
191
- .value=${username}
192
- autocomplete="off"
193
- autocapitalize="off"
194
- ><md-icon slot="leading-icon">id_card</md-icon></md-filled-text-field
195
- >
196
- </div>
197
- <div class="field">
198
- <md-filled-text-field
199
- name="password"
200
- type="password"
201
- label=${String(i18next.t('field.password'))}
202
- autocomplete="off"
203
- required
204
- ><md-icon slot="leading-icon">password</md-icon></md-filled-text-field
205
- >
206
- </div>
207
-
208
- <md-elevated-button class="ui" type="button" raised @click=${e => this._onSubmit(e)}>
209
- <ox-i18n msgid="field.${this.pageName}"> </ox-i18n>
210
- </md-elevated-button>
211
- `
212
- }
213
-
214
- get links() {
215
- const { disableUserSignupProcess, ssoLinks = [] } = this.data || {}
216
-
217
- return html`
218
- ${!disableUserSignupProcess
219
- ? html`
220
- <a class="link" href="/auth/signup">
221
- <md-text-button>
222
- <md-icon slot="icon">add_task</md-icon>
223
- <ox-i18n msgid="field.sign up"></ox-i18n>
224
- </md-text-button>
225
- </a>
226
- <a class="link" href="/auth/forgot-password">
227
- <md-text-button>
228
- <md-icon slot="icon">lock_open</md-icon>
229
- <ox-i18n msgid="field.forgot-password"></ox-i18n>
230
- </md-text-button>
231
- </a>
232
- `
233
- : nothing}
234
- ${ssoLinks.map(
235
- sso => html`
236
- <a class="link" href=${sso.link}>
237
- <md-text-button>
238
- <md-icon slot="icon">id_card</md-icon>
239
- ${i18next.t('label.signin with', { title: sso.title })}
240
- </md-text-button>
241
- </a>
242
- `
243
- )}
244
- `
245
- }
246
-
247
- async _onSubmit(e) {
248
- if (this.checkValidity()) {
249
- this.submit()
250
- }
251
- }
252
-
253
- checkValidity() {
254
- return this.formElements.every(el => el.checkValidity())
255
- }
256
-
257
- abstract submit()
258
-
259
- showSnackbar({ level, message, timer = 3000 }: { level?: string; message?: string; timer?: number } = {}) {
260
- const snackbar = this.renderRoot.querySelector('#snackbar') as HTMLElement & {
261
- level: string
262
- message: string
263
- active: boolean
264
- }
265
-
266
- if (level) snackbar.level = level
267
- if (message) snackbar.message = message
268
- snackbar.active = true
269
-
270
- if (timer > -1)
271
- setTimeout(() => {
272
- this.hideSnackbar()
273
- }, timer)
274
- }
275
-
276
- hideSnackbar() {
277
- const snackbar = this.renderRoot.querySelector('#snackbar') as HTMLElement & {
278
- level: string
279
- message: string
280
- active: boolean
281
- }
282
-
283
- snackbar.active = false
284
- }
285
-
286
- get applicationMeta() {
287
- if (!this._applicationMeta) {
288
- var iconLink: HTMLLinkElement | null = document.querySelector('link[rel="application-icon"]')
289
- var titleMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-name"]')
290
- var descriptionMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-description"]')
291
-
292
- this._applicationMeta = {
293
- icon: iconLink?.href || '',
294
- title: titleMeta?.content || 'Things Factory',
295
- description: descriptionMeta?.content || 'Reimagining Software'
296
- }
297
- }
298
-
299
- return this._applicationMeta
300
- }
301
- }
@@ -1,163 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@material/web/button/elevated-button.js'
3
- import '@material/web/textfield/filled-text-field.js'
4
-
5
- import '@operato/i18n/ox-i18n.js'
6
- import '@operato/i18n/ox-i18n-selector.js'
7
- import '@operato/layout/ox-snack-bar.js'
8
-
9
- import '../components/profile-component'
10
-
11
- import { css, html, nothing } from 'lit'
12
- import { property, query } from 'lit/decorators.js'
13
-
14
- import { i18next } from '@operato/i18n'
15
-
16
- import { AUTH_STYLE_SIGN } from '../auth-style-sign'
17
- import { generatePasswordPatternHelp, generatePasswordPatternRegExp } from '../utils/password-rule'
18
- import { AbstractAuthPage } from './abstract-auth-page'
19
-
20
- export abstract class AbstractPasswordReset extends AbstractAuthPage {
21
- static styles = [
22
- css`
23
- :host {
24
- position: relative;
25
- overflow: hidden;
26
-
27
- display: flex;
28
- flex-direction: row;
29
-
30
- width: 100vw;
31
- height: 100vh;
32
- height: 100dvh;
33
- }
34
-
35
- @media print {
36
- :host {
37
- width: 100%;
38
- height: 100%;
39
- min-height: 100vh;
40
- min-height: 100dvh;
41
- }
42
- }
43
- `,
44
- AUTH_STYLE_SIGN
45
- ]
46
-
47
- @property({ type: Object }) data: any
48
- @property({ type: String }) token?: string
49
-
50
- @query('#confirm-password') confirmPass!: HTMLElement
51
-
52
- private passwordPattern: string = ''
53
- private passwordHelp: string = ''
54
-
55
- abstract get submitButtonLabel(): string
56
-
57
- render() {
58
- var { icon, title, description } = this.applicationMeta
59
- const { disableUserFavoredLanguage, languages } = this.data || {}
60
-
61
- return html`
62
- <div class="wrap">
63
- <div class="auth-brand">
64
- <img src=${icon} />
65
- <strong class="name">${title}</strong>
66
- <span class="welcome-msg">${description}</span>
67
- </div>
68
-
69
- <div class="auth-form">
70
- <h3><ox-i18n msgid="title.${this.title}"></ox-i18n></h3>
71
- <form
72
- id="form"
73
- action="${this.actionUrl}"
74
- method="post"
75
- @keypress=${e => {
76
- if (e.key == 'Enter') this._onSubmit(e)
77
- }}
78
- >
79
- <input name="token" type="hidden" .value=${this.token || ''} required />
80
- <div class="field">
81
- <md-filled-text-field
82
- name="password"
83
- type="password"
84
- label=${String(i18next.t('label.password'))}
85
- pattern=${this.passwordPattern || ''}
86
- supporting-text=${this.passwordHelp}
87
- autocomplete="off"
88
- @input=${e => {
89
- var val = e.target.value
90
- this.confirmPass.setAttribute('pattern', val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '[$&]'))
91
- }}
92
- required
93
- ><md-icon slot="leading-icon">password</md-icon></md-filled-text-field
94
- >
95
- </div>
96
-
97
- <div class="field">
98
- <md-filled-text-field
99
- id="confirm-password"
100
- name="confirm-password"
101
- type="password"
102
- label=${String(i18next.t('field.confirm password'))}
103
- autocomplete="off"
104
- required
105
- ><md-icon slot="leading-icon">password</md-icon></md-filled-text-field
106
- >
107
- </div>
108
-
109
- <md-elevated-button id="submit-button" type="submit" @click=${e => this._onSubmit(e)}>
110
- <ox-i18n msgid="${this.submitButtonLabel}"></ox-i18n>
111
- </md-elevated-button>
112
-
113
- ${!disableUserFavoredLanguage
114
- ? html` <div id="locale-area">
115
- <label for="locale-selector"><md-icon>language</md-icon></label>
116
- <ox-i18n-selector
117
- id="locale-selector"
118
- value=${i18next.language || 'en-US'}
119
- .languages=${languages}
120
- @change=${e => {
121
- var locale = e.detail
122
- if (!locale) return
123
-
124
- i18next.changeLanguage(locale)
125
- }}
126
- ></ox-i18n-selector>
127
- </div>`
128
- : nothing}
129
- </form>
130
- </div>
131
- </div>
132
-
133
- <ox-snack-bar id="snackbar" level="error" .message=${this.message}></ox-snack-bar>
134
- `
135
- }
136
-
137
- updated(changed) {
138
- super.updated(changed)
139
-
140
- if (changed.has('data')) {
141
- this.token = this.data.token
142
- }
143
-
144
- if (changed.has('message')) {
145
- if (!this.message) {
146
- this.hideSnackbar()
147
- } else {
148
- this.showSnackbar({
149
- timer: -1
150
- })
151
- }
152
- }
153
- }
154
-
155
- languageUpdated() {
156
- this.passwordPattern = generatePasswordPatternRegExp(this.data.passwordRule).source
157
- this.passwordHelp = generatePasswordPatternHelp(this.data.passwordRule)
158
- }
159
-
160
- async submit() {
161
- this.formEl.submit()
162
- }
163
- }