@things-factory/auth-ui 10.1.123 → 10.1.141
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/dist-client/components/profile-component.js +1 -1
- package/dist-client/components/profile-component.js.map +1 -1
- package/dist-client/pages/profile.d.ts +1 -0
- package/dist-client/pages/profile.js +31 -3
- package/dist-client/pages/profile.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/access-request-navigation.test.js +1 -1
- package/dist-client/utils/access-request-navigation.test.js.map +1 -1
- package/package.json +5 -5
- package/dist-client/tsconfig.layout-check.tsbuildinfo +0 -1
|
@@ -95,7 +95,7 @@ let ProfileComponent = class ProfileComponent extends localize(i18next)(LitEleme
|
|
|
95
95
|
--i18n-selector-field-border-radius: var(--border-radius);
|
|
96
96
|
--i18n-selector-field-font: var(--auth-input-field-font);
|
|
97
97
|
/* ox-i18n-selector 가 font 뒤에 font-size(기본 15px)를 다시 선언하므로 크기도 넘겨야 한다 */
|
|
98
|
-
--i18n-selector-field-font-size: 16px;
|
|
98
|
+
--i18n-selector-field-font-size: var(--profile-field-font-size, 16px);
|
|
99
99
|
--i18n-selector-field-border: var(--input-field-border, 1px solid var(--md-sys-color-outline));
|
|
100
100
|
--i18n-selector-field-background-color: var(
|
|
101
101
|
--input-field-background,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-component.js","sourceRoot":"","sources":["../../client/components/profile-component.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AACjC,OAAO,mCAAmC,CAAA;AAC1C,OAAO,sBAAsB,CAAA;AAC7B,OAAO,wBAAwB,CAAA;AAC/B,OAAO,uBAAuB,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EA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AEc;IAAnB,KAAK,CAAC,WAAW,CAAC;8BAAc,gBAAgB;oDAAA;AACjC;IAAf,KAAK,CAAC,OAAO,CAAC;8BAAU,gBAAgB;gDAAA;AACxB;IAAhB,KAAK,CAAC,QAAQ,CAAC;8BAAW,gBAAgB;iDAAA;AACzB;IAAjB,KAAK,CAAC,SAAS,CAAC;8BAAY,gBAAgB;kDAAA;AAhIlC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CA2Z5B","sourcesContent":["import '@operato/i18n/ox-i18n.js'\nimport '@operato/i18n/ox-i18n-selector.js'\nimport './change-password.js'\nimport './delete-user-popup.js'\nimport './my-login-history.js'\n\nimport { gql } from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { startRegistration } from '@simplewebauthn/browser'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { FormFieldStyles } from '@operato/styles'\nimport { auth, getLanguages } from '@things-factory/auth-base/dist-client'\n\nimport { readVerification } from '../utils/webauthn-verification.js'\n\nconst isAvailableWebauthn = 'PublicKeyCredential' in window\n@customElement('profile-component')\nexport class ProfileComponent extends localize(i18next)(LitElement) {\n static styles = [\n FormFieldStyles,\n css`\n :host {\n display: block;\n background-color: var(--md-sys-color-background);\n padding: 15px 0;\n }\n .wrap {\n max-width: var(--profile-wrap-max-width, 400px);\n margin: auto;\n display: grid;\n grid-template-columns: 1fr 1fr;\n }\n\n * {\n box-sizing: border-box;\n }\n\n *:focus {\n outline: none;\n }\n\n /* 색·테두리·모서리·포커스·placeholder 는 FormFieldStyles 가 담당하고, 여기서는 치수만 둔다 */\n input {\n margin: var(--spacing-small) 0;\n padding: 9px;\n border-radius: var(--border-radius);\n font: var(--auth-input-field-font);\n width: var(--auth-input-field-width);\n }\n\n .user {\n background: url(/assets/images/icon-profile.png) center top no-repeat;\n margin: var(--profile-icon-margin);\n padding: 180px 20px 20px 20px;\n color: var(--md-sys-color-secondary);\n font: var(--header-bar-title);\n text-align: center;\n }\n\n hr {\n width: 100%;\n /* rgba(0,0,0,.1) 은 다크 배경에서 보이지 않는다 */\n border: dotted 1px var(--md-sys-color-outline-variant);\n }\n\n .wrap * {\n grid-column: span 2;\n }\n\n label {\n font: bold 14px var(--theme-font);\n color: var(--md-sys-color-primary);\n text-transform: capitalize;\n grid-column: 1;\n }\n\n .wrap *.inline {\n grid-column: unset;\n }\n\n /*\n * 언어 select 는 ox-i18n-selector 의 shadow root 안에 있어 위 input 규칙이 닿지 않는다.\n * 높이가 어긋나지 않도록 인풋과 **같은 값**을 토큰으로 넘긴다(padding 9px, 16px 글자).\n */\n ox-i18n-selector {\n --i18n-selector-field-width: var(--auth-input-field-width);\n /* 여백은 호스트에만 준다 — 내부에도 주면 두 번 더해져 인풋보다 벌어진다 */\n --i18n-selector-field-margin: 0;\n --i18n-selector-field-padding: 9px;\n --i18n-selector-field-border-radius: var(--border-radius);\n --i18n-selector-field-font: var(--auth-input-field-font);\n /* ox-i18n-selector 가 font 뒤에 font-size(기본 15px)를 다시 선언하므로 크기도 넘겨야 한다 */\n --i18n-selector-field-font-size: 16px;\n --i18n-selector-field-border: var(--input-field-border, 1px solid var(--md-sys-color-outline));\n --i18n-selector-field-background-color: var(\n --input-field-background,\n var(--md-sys-color-surface-container-highest)\n );\n --i18n-selector-field-color: var(--input-field-color, var(--md-sys-color-on-surface));\n margin: var(--spacing-small) 0;\n }\n\n md-text-button {\n text-transform: capitalize;\n }\n\n footer {\n padding: 20px;\n text-align: center;\n }\n\n footer p {\n font-size: 14px;\n margin-bottom: 5px;\n color: var(--md-sys-color-on-background);\n }\n\n footer a {\n color: var(--md-sys-color-primary);\n text-decoration: none;\n font-weight: bold;\n }\n `\n ]\n\n @property({ type: String }) username?: string\n @property({ type: String }) email?: string\n @property({ type: String }) name?: string\n\n @state() languages: { code: string; display: string }[] = []\n @state() passwordRule: {\n lowerCase?: boolean\n upperCase?: boolean\n digit?: boolean\n specialCharacter?: boolean\n allowRepeat?: boolean\n useTightPattern?: boolean\n useLoosePattern?: boolean\n tightCharacterLength?: number\n looseCharacterLength?: number\n } = {}\n\n @query('#username') usernameEl!: HTMLInputElement\n @query('#name') nameEl!: HTMLInputElement\n @query('#email') emailEl!: HTMLInputElement\n @query('#locale') localeEl!: HTMLInputElement\n\n async connectedCallback(): Promise<void> {\n super.connectedCallback()\n\n const response = await client.query({\n query: gql`\n query {\n passwordRule {\n lowerCase\n upperCase\n digit\n specialCharacter\n allowRepeat\n useTightPattern\n useLoosePattern\n tightCharacterLength\n looseCharacterLength\n }\n }\n `\n })\n\n this.passwordRule = response.data\n }\n\n async firstUpdated() {\n auth.on('profile', ({ credential }) => {\n this.setCredential(credential)\n })\n\n this.setCredential(auth.credential)\n\n this.languages = await getLanguages()\n }\n\n setCredential(credential) {\n if (credential) {\n this.username = credential.username\n this.name = credential.name\n this.email = credential.email\n } else {\n this.username = ''\n this.name = ''\n this.email = ''\n }\n }\n\n render() {\n return html`\n <div class=\"wrap\">\n <div class=\"user\">${this.username || ''}</div>\n\n <label for=\"username\"><ox-i18n slot=\"title\" msgid=\"label.user-id\"></ox-i18n></label>\n <input id=\"username\" @change=${e => this.onUsernameChanged(e.target.value)} .value=${this.username || ''} />\n\n <hr />\n\n <label for=\"name\"><ox-i18n slot=\"title\" msgid=\"label.name\"></ox-i18n></label>\n <input id=\"name\" @change=${e => this.onNameChanged(e.target.value)} .value=${this.name || ''} />\n\n <hr />\n\n <label for=\"email\"><ox-i18n slot=\"title\" msgid=\"label.email\"></ox-i18n></label>\n <input id=\"email\" type=\"email\" @change=${e => this.onEmailChanged(e.target.value)} .value=${this.email || ''} />\n\n <hr />\n\n <label for=\"locale\"><ox-i18n slot=\"title\" msgid=\"label.language\"></ox-i18n></label>\n <ox-i18n-selector\n id=\"locale\"\n @change=${e => this.onLocaleChanged(e.detail)}\n value=${i18next.language || 'en-US'}\n .languages=${this.languages}\n ></ox-i18n-selector>\n\n <hr />\n\n <label for=\"change-password\">\n <ox-i18n msgid=\"label.password\"></ox-i18n>\n </label>\n\n <change-password id=\"change-password\" .passwordRule=${this.passwordRule}></change-password>\n\n ${\n isAvailableWebauthn\n ? html`\n <md-text-button @click=${() => this.registerUser()}\n >${i18next.t('button.security-key registration')}</md-text-button\n >\n `\n : nothing\n }\n\n <footer>\n <p>\n ${i18next.t('text.click login history')}\n <a href=\"javascript:void(0);\" @click=${this.openLoginHistory.bind(this)}\n >${i18next.t('label.login_history')}</a\n >\n </p>\n </footer>\n </div>\n `\n }\n\n async onUsernameChanged(username) {\n if (!username) return\n\n var oldUsername = this.username\n\n try {\n const message = await auth.updateProfile({\n username\n })\n\n notify({\n level: 'info',\n message\n })\n } catch (e: any) {\n this.usernameEl.value = oldUsername || ''\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n\n async onNameChanged(name) {\n if (!name) return\n\n var oldName = this.name\n\n try {\n const message = await auth.updateProfile({\n name\n })\n\n notify({\n level: 'info',\n message\n })\n } catch (e: any) {\n this.nameEl.value = oldName || ''\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n\n async onEmailChanged(email) {\n if (!email) return\n\n var oldEmail = this.email\n\n try {\n const message = await auth.updateProfile({\n email\n })\n\n notify({\n level: 'info',\n message\n })\n } catch (e: any) {\n this.emailEl.value = oldEmail || ''\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n\n async onLocaleChanged(value) {\n if (!value) return\n\n var oldLocale = i18next.language\n\n try {\n const message = await auth.updateProfile({\n locale: value\n })\n\n i18next.changeLanguage(value)\n\n notify({\n level: 'info',\n message\n })\n } catch (e: any) {\n this.localeEl.value = oldLocale\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n\n openLoginHistory() {\n openPopup(html` <my-login-history></my-login-history> `, {\n title: i18next.t('label.login_history')\n })\n }\n\n deleteUser() {\n openPopup(html` <delete-user-popup></delete-user-popup> `, {\n title: i18next.t('label.delete account')\n })\n }\n\n /*\n * ⚠ The three endings here are not interchangeable, and the screen used to give the same one\n * for all of them.\n *\n * registered the server confirmed it\n * refused the server said no — usually this credential is already registered\n * failed we never got an answer: the browser refused, the device was cancelled,\n * the network dropped\n *\n * `await verification.text()` on an already-parsed body threw a TypeError that the catch\n * below swallowed, so **refused arrived as failed** and the refusal message was unreachable\n * code. `readVerification` works out which ending it is without being able to throw; see\n * `utils/webauthn-verification.ts`.\n */\n async registerUser() {\n try {\n const options = await fetch('/auth/register-webauthn/challenge').then(res => res.json())\n const attResp = await startRegistration(options)\n\n const verification = await readVerification(\n await fetch('/auth/verify-registration', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(attResp)\n })\n )\n\n if (verification.outcome === 'registered') {\n notify({\n level: 'info',\n message: i18next.t('text.user credential registered successfully')\n })\n\n return\n }\n\n /* The server's own words, in English, for whoever reads the console — not for the screen. */\n console.error('passkey registration refused:', verification.reason)\n\n notify({\n level: 'error',\n message: i18next.t('error.user credential registration not allowed')\n })\n } catch (error) {\n /* Never reached the server, or never got past the device. A different thing to say. */\n console.error('passkey registration failed:', error)\n\n notify({\n level: 'error',\n message: i18next.t('error.user credential registration failed')\n })\n }\n }\n\n get applicationMeta() {\n var iconLink: HTMLLinkElement | null = document.querySelector('link[rel=\"application-icon\"]')\n var titleMeta: HTMLMetaElement | null = document.querySelector('meta[name=\"application-name\"]')\n var descriptionMeta: HTMLMetaElement | null = document.querySelector('meta[name=\"application-description\"]')\n\n return {\n icon: iconLink?.href || '',\n title: titleMeta?.content || 'Things Factory',\n description: descriptionMeta?.content || 'Reimagining Software'\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"profile-component.js","sourceRoot":"","sources":["../../client/components/profile-component.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AACjC,OAAO,mCAAmC,CAAA;AAC1C,OAAO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EAAE,CAAC;;kDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAc;AAEhC;IAAR,KAAK,EAAE;;mDAAoD;AACnD;IAAR,KAAK,EAAE;;sDAUF;AAEc;IAAnB,KAAK,CAAC,WAAW,CAAC;8BAAc,gBAAgB;oDAAA;AACjC;IAAf,KAAK,CAAC,OAAO,CAAC;8BAAU,gBAAgB;gDAAA;AACxB;IAAhB,KAAK,CAAC,QAAQ,CAAC;8BAAW,gBAAgB;iDAAA;AACzB;IAAjB,KAAK,CAAC,SAAS,CAAC;8BAAY,gBAAgB;kDAAA;AAhIlC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CA2Z5B","sourcesContent":["import '@operato/i18n/ox-i18n.js'\nimport '@operato/i18n/ox-i18n-selector.js'\nimport './change-password.js'\nimport './delete-user-popup.js'\nimport './my-login-history.js'\n\nimport { gql } from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { startRegistration } from '@simplewebauthn/browser'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { FormFieldStyles } from '@operato/styles'\nimport { auth, getLanguages } from '@things-factory/auth-base/dist-client'\n\nimport { readVerification } from '../utils/webauthn-verification.js'\n\nconst isAvailableWebauthn = 'PublicKeyCredential' in window\n@customElement('profile-component')\nexport class ProfileComponent extends localize(i18next)(LitElement) {\n static styles = [\n FormFieldStyles,\n css`\n :host {\n display: block;\n background-color: var(--md-sys-color-background);\n padding: 15px 0;\n }\n .wrap {\n max-width: var(--profile-wrap-max-width, 400px);\n margin: auto;\n display: grid;\n grid-template-columns: 1fr 1fr;\n }\n\n * {\n box-sizing: border-box;\n }\n\n *:focus {\n outline: none;\n }\n\n /* 색·테두리·모서리·포커스·placeholder 는 FormFieldStyles 가 담당하고, 여기서는 치수만 둔다 */\n input {\n margin: var(--spacing-small) 0;\n padding: 9px;\n border-radius: var(--border-radius);\n font: var(--auth-input-field-font);\n width: var(--auth-input-field-width);\n }\n\n .user {\n background: url(/assets/images/icon-profile.png) center top no-repeat;\n margin: var(--profile-icon-margin);\n padding: 180px 20px 20px 20px;\n color: var(--md-sys-color-secondary);\n font: var(--header-bar-title);\n text-align: center;\n }\n\n hr {\n width: 100%;\n /* rgba(0,0,0,.1) 은 다크 배경에서 보이지 않는다 */\n border: dotted 1px var(--md-sys-color-outline-variant);\n }\n\n .wrap * {\n grid-column: span 2;\n }\n\n label {\n font: bold 14px var(--theme-font);\n color: var(--md-sys-color-primary);\n text-transform: capitalize;\n grid-column: 1;\n }\n\n .wrap *.inline {\n grid-column: unset;\n }\n\n /*\n * 언어 select 는 ox-i18n-selector 의 shadow root 안에 있어 위 input 규칙이 닿지 않는다.\n * 높이가 어긋나지 않도록 인풋과 **같은 값**을 토큰으로 넘긴다(padding 9px, 16px 글자).\n */\n ox-i18n-selector {\n --i18n-selector-field-width: var(--auth-input-field-width);\n /* 여백은 호스트에만 준다 — 내부에도 주면 두 번 더해져 인풋보다 벌어진다 */\n --i18n-selector-field-margin: 0;\n --i18n-selector-field-padding: 9px;\n --i18n-selector-field-border-radius: var(--border-radius);\n --i18n-selector-field-font: var(--auth-input-field-font);\n /* ox-i18n-selector 가 font 뒤에 font-size(기본 15px)를 다시 선언하므로 크기도 넘겨야 한다 */\n --i18n-selector-field-font-size: var(--profile-field-font-size, 16px);\n --i18n-selector-field-border: var(--input-field-border, 1px solid var(--md-sys-color-outline));\n --i18n-selector-field-background-color: var(\n --input-field-background,\n var(--md-sys-color-surface-container-highest)\n );\n --i18n-selector-field-color: var(--input-field-color, var(--md-sys-color-on-surface));\n margin: var(--spacing-small) 0;\n }\n\n md-text-button {\n text-transform: capitalize;\n }\n\n footer {\n padding: 20px;\n text-align: center;\n }\n\n footer p {\n font-size: 14px;\n margin-bottom: 5px;\n color: var(--md-sys-color-on-background);\n }\n\n footer a {\n color: var(--md-sys-color-primary);\n text-decoration: none;\n font-weight: bold;\n }\n `\n ]\n\n @property({ type: String }) username?: string\n @property({ type: String }) email?: string\n @property({ type: String }) name?: string\n\n @state() languages: { code: string; display: string }[] = []\n @state() passwordRule: {\n lowerCase?: boolean\n upperCase?: boolean\n digit?: boolean\n specialCharacter?: boolean\n allowRepeat?: boolean\n useTightPattern?: boolean\n useLoosePattern?: boolean\n tightCharacterLength?: number\n looseCharacterLength?: number\n } = {}\n\n @query('#username') usernameEl!: HTMLInputElement\n @query('#name') nameEl!: HTMLInputElement\n @query('#email') emailEl!: HTMLInputElement\n @query('#locale') localeEl!: HTMLInputElement\n\n async connectedCallback(): Promise<void> {\n super.connectedCallback()\n\n const response = await client.query({\n query: gql`\n query {\n passwordRule {\n lowerCase\n upperCase\n digit\n specialCharacter\n allowRepeat\n useTightPattern\n useLoosePattern\n tightCharacterLength\n looseCharacterLength\n }\n }\n `\n })\n\n this.passwordRule = response.data\n }\n\n async firstUpdated() {\n auth.on('profile', ({ credential }) => {\n this.setCredential(credential)\n })\n\n this.setCredential(auth.credential)\n\n this.languages = await getLanguages()\n }\n\n setCredential(credential) {\n if (credential) {\n this.username = credential.username\n this.name = credential.name\n this.email = credential.email\n } else {\n this.username = ''\n this.name = ''\n this.email = ''\n }\n }\n\n render() {\n return html`\n <div class=\"wrap\">\n <div class=\"user\">${this.username || ''}</div>\n\n <label for=\"username\"><ox-i18n slot=\"title\" msgid=\"label.user-id\"></ox-i18n></label>\n <input id=\"username\" @change=${e => this.onUsernameChanged(e.target.value)} .value=${this.username || ''} />\n\n <hr />\n\n <label for=\"name\"><ox-i18n slot=\"title\" msgid=\"label.name\"></ox-i18n></label>\n <input id=\"name\" @change=${e => this.onNameChanged(e.target.value)} .value=${this.name || ''} />\n\n <hr />\n\n <label for=\"email\"><ox-i18n slot=\"title\" msgid=\"label.email\"></ox-i18n></label>\n <input id=\"email\" type=\"email\" @change=${e => this.onEmailChanged(e.target.value)} .value=${this.email || ''} />\n\n <hr />\n\n <label for=\"locale\"><ox-i18n slot=\"title\" msgid=\"label.language\"></ox-i18n></label>\n <ox-i18n-selector\n id=\"locale\"\n @change=${e => this.onLocaleChanged(e.detail)}\n value=${i18next.language || 'en-US'}\n .languages=${this.languages}\n ></ox-i18n-selector>\n\n <hr />\n\n <label for=\"change-password\">\n <ox-i18n msgid=\"label.password\"></ox-i18n>\n </label>\n\n <change-password id=\"change-password\" .passwordRule=${this.passwordRule}></change-password>\n\n ${\n isAvailableWebauthn\n ? html`\n <md-text-button @click=${() => this.registerUser()}\n >${i18next.t('button.security-key registration')}</md-text-button\n >\n `\n : nothing\n }\n\n <footer>\n <p>\n ${i18next.t('text.click login history')}\n <a href=\"javascript:void(0);\" @click=${this.openLoginHistory.bind(this)}\n >${i18next.t('label.login_history')}</a\n >\n </p>\n </footer>\n </div>\n `\n }\n\n async onUsernameChanged(username) {\n if (!username) return\n\n var oldUsername = this.username\n\n try {\n const message = await auth.updateProfile({\n username\n })\n\n notify({\n level: 'info',\n message\n })\n } catch (e: any) {\n this.usernameEl.value = oldUsername || ''\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n\n async onNameChanged(name) {\n if (!name) return\n\n var oldName = this.name\n\n try {\n const message = await auth.updateProfile({\n name\n })\n\n notify({\n level: 'info',\n message\n })\n } catch (e: any) {\n this.nameEl.value = oldName || ''\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n\n async onEmailChanged(email) {\n if (!email) return\n\n var oldEmail = this.email\n\n try {\n const message = await auth.updateProfile({\n email\n })\n\n notify({\n level: 'info',\n message\n })\n } catch (e: any) {\n this.emailEl.value = oldEmail || ''\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n\n async onLocaleChanged(value) {\n if (!value) return\n\n var oldLocale = i18next.language\n\n try {\n const message = await auth.updateProfile({\n locale: value\n })\n\n i18next.changeLanguage(value)\n\n notify({\n level: 'info',\n message\n })\n } catch (e: any) {\n this.localeEl.value = oldLocale\n\n notify({\n level: 'error',\n message: 'message' in e ? e.message : e\n })\n }\n }\n\n openLoginHistory() {\n openPopup(html` <my-login-history></my-login-history> `, {\n title: i18next.t('label.login_history')\n })\n }\n\n deleteUser() {\n openPopup(html` <delete-user-popup></delete-user-popup> `, {\n title: i18next.t('label.delete account')\n })\n }\n\n /*\n * ⚠ The three endings here are not interchangeable, and the screen used to give the same one\n * for all of them.\n *\n * registered the server confirmed it\n * refused the server said no — usually this credential is already registered\n * failed we never got an answer: the browser refused, the device was cancelled,\n * the network dropped\n *\n * `await verification.text()` on an already-parsed body threw a TypeError that the catch\n * below swallowed, so **refused arrived as failed** and the refusal message was unreachable\n * code. `readVerification` works out which ending it is without being able to throw; see\n * `utils/webauthn-verification.ts`.\n */\n async registerUser() {\n try {\n const options = await fetch('/auth/register-webauthn/challenge').then(res => res.json())\n const attResp = await startRegistration(options)\n\n const verification = await readVerification(\n await fetch('/auth/verify-registration', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(attResp)\n })\n )\n\n if (verification.outcome === 'registered') {\n notify({\n level: 'info',\n message: i18next.t('text.user credential registered successfully')\n })\n\n return\n }\n\n /* The server's own words, in English, for whoever reads the console — not for the screen. */\n console.error('passkey registration refused:', verification.reason)\n\n notify({\n level: 'error',\n message: i18next.t('error.user credential registration not allowed')\n })\n } catch (error) {\n /* Never reached the server, or never got past the device. A different thing to say. */\n console.error('passkey registration failed:', error)\n\n notify({\n level: 'error',\n message: i18next.t('error.user credential registration failed')\n })\n }\n }\n\n get applicationMeta() {\n var iconLink: HTMLLinkElement | null = document.querySelector('link[rel=\"application-icon\"]')\n var titleMeta: HTMLMetaElement | null = document.querySelector('meta[name=\"application-name\"]')\n var descriptionMeta: HTMLMetaElement | null = document.querySelector('meta[name=\"application-description\"]')\n\n return {\n icon: iconLink?.href || '',\n title: titleMeta?.content || 'Things Factory',\n description: descriptionMeta?.content || 'Reimagining Software'\n }\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import '../components/profile-component.js';
|
|
3
|
-
import { html } from 'lit';
|
|
3
|
+
import { css, html } from 'lit';
|
|
4
4
|
import { customElement } from 'lit/decorators.js';
|
|
5
5
|
import { i18next, localize } from '@operato/i18n';
|
|
6
6
|
import { navigate, PageView } from '@operato/shell';
|
|
@@ -10,7 +10,33 @@ let AuthProfile = class AuthProfile extends localize(i18next)(PageView) {
|
|
|
10
10
|
* The frame owns the page shell (ADR-0060 decision 8). `profile-component` centres its own
|
|
11
11
|
* column, so this screen adds no `.page` of its own on top of it.
|
|
12
12
|
*/
|
|
13
|
-
static { this.styles = [
|
|
13
|
+
static { this.styles = [
|
|
14
|
+
DocumentPageStyles,
|
|
15
|
+
ScrollbarStyles,
|
|
16
|
+
css `
|
|
17
|
+
/*
|
|
18
|
+
* The sign-in theme sizes auth fields for a page with two fields (16, 20 on narrow screens). With a
|
|
19
|
+
* mouse they sit in a settings form among body text, so they take the body size. With a finger they
|
|
20
|
+
* stay at 16: iOS zooms the page into any field whose text is smaller than that. The component,
|
|
21
|
+
* shared with the sign-in pages, is left as it is.
|
|
22
|
+
*/
|
|
23
|
+
@media (pointer: fine) {
|
|
24
|
+
profile-component {
|
|
25
|
+
--auth-input-field-font: normal var(--ui-t-body, 13px) var(--theme-font);
|
|
26
|
+
--change-password-field-font: normal var(--ui-t-body, 13px) var(--theme-font);
|
|
27
|
+
--profile-field-font-size: var(--ui-t-body, 13px);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media (pointer: coarse) {
|
|
32
|
+
profile-component {
|
|
33
|
+
--auth-input-field-font: normal 16px var(--theme-font);
|
|
34
|
+
--change-password-field-font: normal 16px var(--theme-font);
|
|
35
|
+
--profile-field-font-size: 16px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`
|
|
39
|
+
]; }
|
|
14
40
|
get context() {
|
|
15
41
|
return {
|
|
16
42
|
/*
|
|
@@ -19,7 +45,9 @@ let AuthProfile = class AuthProfile extends localize(i18next)(PageView) {
|
|
|
19
45
|
*/
|
|
20
46
|
frame: 'document',
|
|
21
47
|
title: i18next.t('text.auth profile'),
|
|
22
|
-
|
|
48
|
+
/* The tab names the screen and the page opens with the person's own name; a title bar says it again. */
|
|
49
|
+
heading: false,
|
|
50
|
+
actions: [{ title: i18next.t('access-request.title.my access requests'), icon: 'history', action: () => navigate('my-access-requests') }]
|
|
23
51
|
};
|
|
24
52
|
}
|
|
25
53
|
render() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../client/pages/profile.ts"],"names":[],"mappings":";AAAA,OAAO,oCAAoC,CAAA;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../client/pages/profile.ts"],"names":[],"mappings":";AAAA,OAAO,oCAAoC,CAAA;AAE3C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAG9D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAC1D;;;OAGG;aACI,WAAM,GAAG;QACd,kBAAkB;QAClB,eAAe;QACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;KAsBF;KACF,AA1BY,CA0BZ;IAED,IAAI,OAAO;QACT,OAAO;YACL;;;eAGG;YACH,KAAK,EAAE,UAAU;YACjB,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC;YACrC,wGAAwG;YACxG,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,yCAAyC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;SAC1I,CAAA;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA,2CAA2C,CAAA;IACxD,CAAC;;AAjDU,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkDvB","sourcesContent":["import '../components/profile-component.js'\n\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { navigate, PageView } from '@operato/shell'\nimport { DocumentPageStyles, ScrollbarStyles } from '@operato/styles'\n\n@customElement('auth-profile')\nexport class AuthProfile extends localize(i18next)(PageView) {\n /*\n * The frame owns the page shell (ADR-0060 decision 8). `profile-component` centres its own\n * column, so this screen adds no `.page` of its own on top of it.\n */\n static styles = [\n DocumentPageStyles,\n ScrollbarStyles,\n css`\n /*\n * The sign-in theme sizes auth fields for a page with two fields (16, 20 on narrow screens). With a\n * mouse they sit in a settings form among body text, so they take the body size. With a finger they\n * stay at 16: iOS zooms the page into any field whose text is smaller than that. The component,\n * shared with the sign-in pages, is left as it is.\n */\n @media (pointer: fine) {\n profile-component {\n --auth-input-field-font: normal var(--ui-t-body, 13px) var(--theme-font);\n --change-password-field-font: normal var(--ui-t-body, 13px) var(--theme-font);\n --profile-field-font-size: var(--ui-t-body, 13px);\n }\n }\n\n @media (pointer: coarse) {\n profile-component {\n --auth-input-field-font: normal 16px var(--theme-font);\n --change-password-field-font: normal 16px var(--theme-font);\n --profile-field-font-size: 16px;\n }\n }\n `\n ]\n\n get context() {\n return {\n /*\n * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다\n * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.\n */\n frame: 'document',\n title: i18next.t('text.auth profile'),\n /* The tab names the screen and the page opens with the person's own name; a title bar says it again. */\n heading: false,\n actions: [{ title: i18next.t('access-request.title.my access requests'), icon: 'history', action: () => navigate('my-access-requests') }]\n }\n }\n\n render() {\n return html` <profile-component></profile-component> `\n }\n}\n"]}
|