@proteinjs/user-ui 1.11.1 → 1.11.2
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 +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/src/auth/AuthFormFields.d.ts +18 -0
- package/dist/src/auth/AuthFormFields.d.ts.map +1 -0
- package/dist/src/auth/AuthFormFields.js +41 -0
- package/dist/src/auth/AuthFormFields.js.map +1 -0
- package/dist/src/auth/AuthTextField.d.ts +14 -2
- package/dist/src/auth/AuthTextField.d.ts.map +1 -1
- package/dist/src/auth/AuthTextField.js +5 -3
- package/dist/src/auth/AuthTextField.js.map +1 -1
- package/dist/src/auth/AuthValidation.d.ts +17 -4
- package/dist/src/auth/AuthValidation.d.ts.map +1 -1
- package/dist/src/auth/AuthValidation.js +41 -11
- package/dist/src/auth/AuthValidation.js.map +1 -1
- package/dist/src/pages/ForgotPassword.d.ts.map +1 -1
- package/dist/src/pages/ForgotPassword.js +14 -4
- package/dist/src/pages/ForgotPassword.js.map +1 -1
- package/dist/src/pages/Login.d.ts.map +1 -1
- package/dist/src/pages/Login.js +40 -14
- package/dist/src/pages/Login.js.map +1 -1
- package/dist/src/pages/PasswordReset.d.ts.map +1 -1
- package/dist/src/pages/PasswordReset.js +37 -17
- package/dist/src/pages/PasswordReset.js.map +1 -1
- package/dist/src/pages/Signup.d.ts.map +1 -1
- package/dist/src/pages/Signup.js +44 -21
- package/dist/src/pages/Signup.js.map +1 -1
- package/dist/test/authFormsReadTheirFields.test.d.ts +5 -0
- package/dist/test/authFormsReadTheirFields.test.d.ts.map +1 -0
- package/dist/test/authFormsReadTheirFields.test.js +595 -0
- package/dist/test/authFormsReadTheirFields.test.js.map +1 -0
- package/dist/test/authValidation.test.js +43 -8
- package/dist/test/authValidation.test.js.map +1 -1
- package/index.ts +4 -0
- package/package.json +2 -2
- package/src/auth/AuthFormFields.ts +35 -0
- package/src/auth/AuthTextField.tsx +23 -3
- package/src/auth/AuthValidation.ts +54 -15
- package/src/pages/ForgotPassword.tsx +18 -5
- package/src/pages/Login.tsx +27 -8
- package/src/pages/PasswordReset.tsx +22 -11
- package/src/pages/Signup.tsx +39 -16
- package/test/authFormsReadTheirFields.test.tsx +369 -0
- package/test/authValidation.test.ts +49 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.11.2](https://github.com/proteinjs/user/compare/@proteinjs/user-ui@1.11.1...@proteinjs/user-ui@1.11.2) (2026-09-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui:** the sign-in form reads its fields at submit ([b0eda61](https://github.com/proteinjs/user/commit/b0eda61cf9f6a990179f83a8fd4edb045af22c57))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.11.1](https://github.com/proteinjs/user/compare/@proteinjs/user-ui@1.11.0...@proteinjs/user-ui@1.11.1) (2026-09-20)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @proteinjs/user-ui
|
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export * from './src/auth/AuthTextField';
|
|
|
7
7
|
export * from './src/auth/AuthButton';
|
|
8
8
|
export * from './src/auth/AuthFormError';
|
|
9
9
|
export * from './src/auth/AuthMessagePanel';
|
|
10
|
+
export * from './src/auth/AuthFormFields';
|
|
11
|
+
export type { AuthFieldErrors } from './src/auth/AuthValidation';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAI3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAI3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAG5C,cAAc,2BAA2B,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,4 +25,7 @@ __exportStar(require("./src/auth/AuthTextField"), exports);
|
|
|
25
25
|
__exportStar(require("./src/auth/AuthButton"), exports);
|
|
26
26
|
__exportStar(require("./src/auth/AuthFormError"), exports);
|
|
27
27
|
__exportStar(require("./src/auth/AuthMessagePanel"), exports);
|
|
28
|
+
// The form reader the pages above use at submit (uncontrolled fields; the values read from the
|
|
29
|
+
// form itself) — exported so a consumer page fixes the same class the same way, not by hand.
|
|
30
|
+
__exportStar(require("./src/auth/AuthFormFields"), exports);
|
|
28
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,iDAA+B;AAC/B,sEAAoD;AACpD,6EAA2D;AAE3D,0FAA0F;AAC1F,+FAA+F;AAC/F,wDAAsC;AACtC,2DAAyC;AACzC,wDAAsC;AACtC,2DAAyC;AACzC,8DAA4C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,iDAA+B;AAC/B,sEAAoD;AACpD,6EAA2D;AAE3D,0FAA0F;AAC1F,+FAA+F;AAC/F,wDAAsC;AACtC,2DAAyC;AACzC,wDAAsC;AACtC,2DAAyC;AACzC,8DAA4C;AAC5C,+FAA+F;AAC/F,6FAA6F;AAC7F,4DAA0C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AuthFieldErrors } from './AuthValidation';
|
|
2
|
+
/**
|
|
3
|
+
* Reads an auth form's fields from the form itself when it submits.
|
|
4
|
+
*
|
|
5
|
+
* A password manager, the platform's autofill service or an input method can write a field's
|
|
6
|
+
* value without the `input` event React listens for: the field looks filled while component
|
|
7
|
+
* state is still empty, and a controlled field's next re-render (the focus ring moving as the
|
|
8
|
+
* person taps the button is enough) writes that empty state back over the value. So the fields
|
|
9
|
+
* a person fills are uncontrolled — each carries a `name` and owns its value in the DOM — and
|
|
10
|
+
* the submit handler reads them here. There is no second copy of a value to fall out of step.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AuthFormFields {
|
|
13
|
+
/** The named fields' current values; '' for a name the form does not carry. */
|
|
14
|
+
static read<F extends string>(form: HTMLFormElement, names: readonly F[]): Record<F, string>;
|
|
15
|
+
/** Focuses the first field, in document order, that carries an error (the keyboard opens there). */
|
|
16
|
+
static focusFirstInvalid<F extends string>(form: HTMLFormElement, errors: AuthFieldErrors<F>): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=AuthFormFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthFormFields.d.ts","sourceRoot":"","sources":["../../../src/auth/AuthFormFields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;GASG;AACH,qBAAa,cAAc;IACzB,+EAA+E;IAC/E,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC;IAU5F,oGAAoG;IACpG,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CAS7F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthFormFields = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Reads an auth form's fields from the form itself when it submits.
|
|
6
|
+
*
|
|
7
|
+
* A password manager, the platform's autofill service or an input method can write a field's
|
|
8
|
+
* value without the `input` event React listens for: the field looks filled while component
|
|
9
|
+
* state is still empty, and a controlled field's next re-render (the focus ring moving as the
|
|
10
|
+
* person taps the button is enough) writes that empty state back over the value. So the fields
|
|
11
|
+
* a person fills are uncontrolled — each carries a `name` and owns its value in the DOM — and
|
|
12
|
+
* the submit handler reads them here. There is no second copy of a value to fall out of step.
|
|
13
|
+
*/
|
|
14
|
+
var AuthFormFields = /** @class */ (function () {
|
|
15
|
+
function AuthFormFields() {
|
|
16
|
+
}
|
|
17
|
+
/** The named fields' current values; '' for a name the form does not carry. */
|
|
18
|
+
AuthFormFields.read = function (form, names) {
|
|
19
|
+
var data = new FormData(form);
|
|
20
|
+
var values = {};
|
|
21
|
+
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
|
|
22
|
+
var name_1 = names_1[_i];
|
|
23
|
+
var value = data.get(name_1);
|
|
24
|
+
values[name_1] = typeof value === 'string' ? value : '';
|
|
25
|
+
}
|
|
26
|
+
return values;
|
|
27
|
+
};
|
|
28
|
+
/** Focuses the first field, in document order, that carries an error (the keyboard opens there). */
|
|
29
|
+
AuthFormFields.focusFirstInvalid = function (form, errors) {
|
|
30
|
+
for (var index = 0; index < form.elements.length; index++) {
|
|
31
|
+
var element = form.elements[index];
|
|
32
|
+
if (element.name && errors[element.name]) {
|
|
33
|
+
element.focus();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return AuthFormFields;
|
|
39
|
+
}());
|
|
40
|
+
exports.AuthFormFields = AuthFormFields;
|
|
41
|
+
//# sourceMappingURL=AuthFormFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthFormFields.js","sourceRoot":"","sources":["../../../src/auth/AuthFormFields.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;GASG;AACH;IAAA;IAsBA,CAAC;IArBC,+EAA+E;IACxE,mBAAI,GAAX,UAA8B,IAAqB,EAAE,KAAmB;QACtE,IAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,IAAM,MAAM,GAAG,EAAuB,CAAC;QACvC,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;YAArB,IAAM,MAAI,cAAA;YACb,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAI,CAAC,CAAC;YAC7B,MAAM,CAAC,MAAI,CAAC,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,oGAAoG;IAC7F,gCAAiB,GAAxB,UAA2C,IAAqB,EAAE,MAA0B;QAC1F,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACzD,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAqB,CAAC;YACzD,IAAI,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,IAAS,CAAC,EAAE;gBAC7C,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,OAAO;aACR;SACF;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AAtBD,IAsBC;AAtBY,wCAAc"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface AuthTextFieldProps {
|
|
3
3
|
label: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The form-field name the page reads the value by when the form submits
|
|
6
|
+
* (`AuthFormFields.read`). A field the person fills is uncontrolled — it carries `name` (and an
|
|
7
|
+
* optional `defaultValue`) and no `value` — so whatever writes into it (typing, a password
|
|
8
|
+
* manager, the platform's autofill) is exactly what the submit reads.
|
|
9
|
+
*/
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Controlled value — for a field the page itself fills (e.g. a read-only identity). */
|
|
12
|
+
value?: string;
|
|
13
|
+
/** Initial value of an uncontrolled field. */
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
/** Called on every edit the browser announces; an uncontrolled field's value stays in the DOM. */
|
|
6
16
|
onChange?: (value: string) => void;
|
|
17
|
+
/** Marks the field invalid and shows this message under it (in place of `helperText`). */
|
|
18
|
+
error?: string;
|
|
7
19
|
/** Renders a reveal toggle and masks input until toggled. */
|
|
8
20
|
password?: boolean;
|
|
9
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthTextField.d.ts","sourceRoot":"","sources":["../../../src/auth/AuthTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"AuthTextField.d.ts","sourceRoot":"","sources":["../../../src/auth/AuthTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8FAA8F;IAC9F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBA8EtD"}
|
|
@@ -48,11 +48,11 @@ var VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff
|
|
|
48
48
|
* target; 1rem input text so mobile browsers don't auto-zoom the field on focus.
|
|
49
49
|
*/
|
|
50
50
|
function AuthTextField(props) {
|
|
51
|
-
var label = props.label, value = props.value, onChange = props.onChange, password = props.password, readOnly = props.readOnly, autoComplete = props.autoComplete, type = props.type, multilineRows = props.multilineRows, helperText = props.helperText, autoFocus = props.autoFocus, disabled = props.disabled;
|
|
51
|
+
var label = props.label, name = props.name, value = props.value, defaultValue = props.defaultValue, onChange = props.onChange, error = props.error, password = props.password, readOnly = props.readOnly, autoComplete = props.autoComplete, type = props.type, multilineRows = props.multilineRows, helperText = props.helperText, autoFocus = props.autoFocus, disabled = props.disabled;
|
|
52
52
|
var _a = (0, react_1.useState)(false), revealed = _a[0], setRevealed = _a[1];
|
|
53
53
|
return (react_1.default.createElement(material_1.Box, { sx: { mb: 2.5 } },
|
|
54
54
|
react_1.default.createElement(material_1.Typography, { component: 'label', htmlFor: "auth-field-".concat(label), sx: { display: 'block', fontSize: '0.875rem', fontWeight: 500, color: 'text.primary', mb: 0.75 } }, label),
|
|
55
|
-
react_1.default.createElement(material_1.TextField, { id: "auth-field-".concat(label), fullWidth: true, value: value, onChange: function (event) { return onChange === null || onChange === void 0 ? void 0 : onChange(event.target.value); }, type: password && !revealed ? 'password' : password ? 'text' : type || 'text', autoComplete: autoComplete, autoFocus: autoFocus, disabled: disabled, multiline: !!multilineRows, rows: multilineRows, helperText: helperText, InputProps: {
|
|
55
|
+
react_1.default.createElement(material_1.TextField, { id: "auth-field-".concat(label), fullWidth: true, name: name, value: value, defaultValue: defaultValue, onChange: function (event) { return onChange === null || onChange === void 0 ? void 0 : onChange(event.target.value); }, type: password && !revealed ? 'password' : password ? 'text' : type || 'text', autoComplete: autoComplete, autoFocus: autoFocus, disabled: disabled, multiline: !!multilineRows, rows: multilineRows, error: !!error, helperText: error !== null && error !== void 0 ? error : helperText, InputProps: {
|
|
56
56
|
readOnly: readOnly,
|
|
57
57
|
endAdornment: password ? (react_1.default.createElement(material_1.InputAdornment, { position: 'end' },
|
|
58
58
|
react_1.default.createElement(material_1.IconButton, { "aria-label": revealed ? 'Hide password' : 'Show password', onClick: function () { return setRevealed(!revealed); }, edge: 'end', sx: { color: 'text.secondary', p: '12px' } }, revealed ? react_1.default.createElement(VisibilityOff_1.default, { sx: { fontSize: 20 } }) : react_1.default.createElement(Visibility_1.default, { sx: { fontSize: 20 } })))) : undefined,
|
|
@@ -60,7 +60,9 @@ function AuthTextField(props) {
|
|
|
60
60
|
'& .MuiOutlinedInput-root': __assign(__assign({ borderRadius: '12px',
|
|
61
61
|
// A read-only field wears a subtle fill and keeps a quiet border, so it reads as a
|
|
62
62
|
// fixed value rather than an input that ignores typing.
|
|
63
|
-
backgroundColor: readOnly ? 'action.hover' : 'background.paper', fontSize: '1rem', '& input': { py: '12.5px', px: '14px' } }, (multilineRows ? { p: '12.5px 14px' } : {})), { '& fieldset': { borderColor: 'divider' }, '&:hover fieldset': { borderColor: readOnly ? 'divider' : 'text.disabled' }, '&.Mui-focused fieldset': { borderColor: 'primary.main', borderWidth: '1.5px' }
|
|
63
|
+
backgroundColor: readOnly ? 'action.hover' : 'background.paper', fontSize: '1rem', '& input': { py: '12.5px', px: '14px' } }, (multilineRows ? { p: '12.5px 14px' } : {})), { '& fieldset': { borderColor: 'divider' }, '&:hover fieldset': { borderColor: readOnly ? 'divider' : 'text.disabled' }, '&.Mui-focused fieldset': { borderColor: 'primary.main', borderWidth: '1.5px' },
|
|
64
|
+
// A marked field keeps its error border while focused (the person is fixing it).
|
|
65
|
+
'&.Mui-error fieldset': { borderColor: 'error.main' } }),
|
|
64
66
|
} })));
|
|
65
67
|
}
|
|
66
68
|
exports.AuthTextField = AuthTextField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthTextField.js","sourceRoot":"","sources":["../../../src/auth/AuthTextField.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,0CAAuF;AACvF,8EAAwD;AACxD,oFAA8D;
|
|
1
|
+
{"version":3,"file":"AuthTextField.js","sourceRoot":"","sources":["../../../src/auth/AuthTextField.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,0CAAuF;AACvF,8EAAwD;AACxD,oFAA8D;AAuC9D;;;;GAIG;AACH,SAAgB,aAAa,CAAC,KAAyB;IAEnD,IAAA,KAA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AC,KAC9C,YAAY,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EACxC,kBAAkB,EAAE,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,EAAE,EAC3E,wBAAwB,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE;oBAC/E,iFAAiF;oBACjF,sBAAsB,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,GACtD;aACF,GACD,CACE,CACP,CAAC;AACJ,CAAC;AA9ED,sCA8EC"}
|
|
@@ -1,18 +1,31 @@
|
|
|
1
|
+
/** A user-readable message per invalid field, keyed by the field's form name. */
|
|
2
|
+
export type AuthFieldErrors<F extends string> = {
|
|
3
|
+
[K in F]?: string;
|
|
4
|
+
};
|
|
1
5
|
/**
|
|
2
|
-
* Client-side validation for the auth flows. Each method returns a
|
|
3
|
-
*
|
|
6
|
+
* Client-side validation for the auth flows. Each method returns the invalid fields with a
|
|
7
|
+
* user-readable message each (the page marks those fields), or undefined when the input is
|
|
8
|
+
* valid. A blank field is refused here, in the page, so a real form never sends one.
|
|
4
9
|
*/
|
|
5
10
|
export declare class AuthValidation {
|
|
11
|
+
static login(fields: {
|
|
12
|
+
email: string;
|
|
13
|
+
password: string;
|
|
14
|
+
}): AuthFieldErrors<'email' | 'password'> | undefined;
|
|
15
|
+
static forgotPassword(fields: {
|
|
16
|
+
email: string;
|
|
17
|
+
}): AuthFieldErrors<'email'> | undefined;
|
|
6
18
|
/** @param invited invited users don't enter an email (the invite token carries it) */
|
|
7
19
|
static signup(fields: {
|
|
8
20
|
name: string;
|
|
9
21
|
email: string;
|
|
10
22
|
password: string;
|
|
11
23
|
confirmPassword: string;
|
|
12
|
-
}, invited: boolean):
|
|
24
|
+
}, invited: boolean): AuthFieldErrors<'name' | 'email' | 'password' | 'confirmPassword'> | undefined;
|
|
13
25
|
static passwordReset(fields: {
|
|
14
26
|
newPassword: string;
|
|
15
27
|
confirmPassword: string;
|
|
16
|
-
}):
|
|
28
|
+
}): AuthFieldErrors<'newPassword' | 'confirmPassword'> | undefined;
|
|
29
|
+
private static outcome;
|
|
17
30
|
}
|
|
18
31
|
//# sourceMappingURL=AuthValidation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthValidation.d.ts","sourceRoot":"","sources":["../../../src/auth/AuthValidation.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"AuthValidation.d.ts","sourceRoot":"","sources":["../../../src/auth/AuthValidation.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI;KAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM;CAAE,CAAC;AAEtE;;;;GAIG;AACH,qBAAa,cAAc;IACzB,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,eAAe,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,SAAS;IAa5G,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,SAAS;IAStF,sFAAsF;IACtF,MAAM,CAAC,MAAM,CACX,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,EAClF,OAAO,EAAE,OAAO,GACf,eAAe,CAAC,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,iBAAiB,CAAC,GAAG,SAAS;IAuBjF,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;KACzB,GAAG,eAAe,CAAC,aAAa,GAAG,iBAAiB,CAAC,GAAG,SAAS;IAWlE,OAAO,CAAC,MAAM,CAAC,OAAO;CAGvB"}
|
|
@@ -3,34 +3,64 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AuthValidation = void 0;
|
|
4
4
|
var util_1 = require("@proteinjs/util");
|
|
5
5
|
/**
|
|
6
|
-
* Client-side validation for the auth flows. Each method returns a
|
|
7
|
-
*
|
|
6
|
+
* Client-side validation for the auth flows. Each method returns the invalid fields with a
|
|
7
|
+
* user-readable message each (the page marks those fields), or undefined when the input is
|
|
8
|
+
* valid. A blank field is refused here, in the page, so a real form never sends one.
|
|
8
9
|
*/
|
|
9
10
|
var AuthValidation = /** @class */ (function () {
|
|
10
11
|
function AuthValidation() {
|
|
11
12
|
}
|
|
13
|
+
AuthValidation.login = function (fields) {
|
|
14
|
+
var errors = {};
|
|
15
|
+
if (!fields.email.trim()) {
|
|
16
|
+
errors.email = 'Enter your email';
|
|
17
|
+
}
|
|
18
|
+
if (!fields.password) {
|
|
19
|
+
errors.password = 'Enter your password';
|
|
20
|
+
}
|
|
21
|
+
return AuthValidation.outcome(errors);
|
|
22
|
+
};
|
|
23
|
+
AuthValidation.forgotPassword = function (fields) {
|
|
24
|
+
var errors = {};
|
|
25
|
+
if (!fields.email.trim()) {
|
|
26
|
+
errors.email = 'Enter your email';
|
|
27
|
+
}
|
|
28
|
+
return AuthValidation.outcome(errors);
|
|
29
|
+
};
|
|
12
30
|
/** @param invited invited users don't enter an email (the invite token carries it) */
|
|
13
31
|
AuthValidation.signup = function (fields, invited) {
|
|
32
|
+
var errors = {};
|
|
14
33
|
if (!fields.name.trim()) {
|
|
15
|
-
|
|
34
|
+
errors.name = 'Enter your name';
|
|
16
35
|
}
|
|
17
|
-
if (!invited
|
|
18
|
-
|
|
36
|
+
if (!invited) {
|
|
37
|
+
if (!fields.email.trim()) {
|
|
38
|
+
errors.email = 'Enter your email';
|
|
39
|
+
}
|
|
40
|
+
else if (!util_1.emailRegex.test(fields.email.trim())) {
|
|
41
|
+
errors.email = 'Enter a valid email address';
|
|
42
|
+
}
|
|
19
43
|
}
|
|
20
44
|
if (!fields.password) {
|
|
21
|
-
|
|
45
|
+
errors.password = 'Enter a password';
|
|
22
46
|
}
|
|
23
|
-
if (fields.password !== fields.confirmPassword) {
|
|
24
|
-
|
|
47
|
+
else if (fields.password !== fields.confirmPassword) {
|
|
48
|
+
errors.confirmPassword = 'Passwords do not match';
|
|
25
49
|
}
|
|
50
|
+
return AuthValidation.outcome(errors);
|
|
26
51
|
};
|
|
27
52
|
AuthValidation.passwordReset = function (fields) {
|
|
53
|
+
var errors = {};
|
|
28
54
|
if (!fields.newPassword) {
|
|
29
|
-
|
|
55
|
+
errors.newPassword = 'Enter a new password';
|
|
30
56
|
}
|
|
31
|
-
if (fields.newPassword !== fields.confirmPassword) {
|
|
32
|
-
|
|
57
|
+
else if (fields.newPassword !== fields.confirmPassword) {
|
|
58
|
+
errors.confirmPassword = 'Passwords do not match';
|
|
33
59
|
}
|
|
60
|
+
return AuthValidation.outcome(errors);
|
|
61
|
+
};
|
|
62
|
+
AuthValidation.outcome = function (errors) {
|
|
63
|
+
return Object.keys(errors).length > 0 ? errors : undefined;
|
|
34
64
|
};
|
|
35
65
|
return AuthValidation;
|
|
36
66
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthValidation.js","sourceRoot":"","sources":["../../../src/auth/AuthValidation.ts"],"names":[],"mappings":";;;AAAA,wCAA6C;
|
|
1
|
+
{"version":3,"file":"AuthValidation.js","sourceRoot":"","sources":["../../../src/auth/AuthValidation.ts"],"names":[],"mappings":";;;AAAA,wCAA6C;AAK7C;;;;GAIG;AACH;IAAA;IAmEA,CAAC;IAlEQ,oBAAK,GAAZ,UAAa,MAA2C;QACtD,IAAM,MAAM,GAA0C,EAAE,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE;YACxB,MAAM,CA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,UAAqB,MAGpB;QACC,IAAM,MAAM,GAAuD,EAAE,CAAC;QACtE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;YACvB,MAAM,CAAC,WAAW,GAAG,sBAAsB,CAAC;SAC7C;aAAM,IAAI,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,eAAe,EAAE;YACxD,MAAM,CAAC,eAAe,GAAG,wBAAwB,CAAC;SACnD;QAED,OAAO,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAEc,sBAAO,GAAtB,UAAyC,MAA0B;QACjE,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7D,CAAC;IACH,qBAAC;AAAD,CAAC,AAnED,IAmEC;AAnEY,wCAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgotPassword.d.ts","sourceRoot":"","sources":["../../../src/pages/ForgotPassword.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ForgotPassword.d.ts","sourceRoot":"","sources":["../../../src/pages/ForgotPassword.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AA0FrC,eAAO,MAAM,kBAAkB,EAAE,IAOhC,CAAC"}
|
|
@@ -70,23 +70,33 @@ var AuthButton_1 = require("../auth/AuthButton");
|
|
|
70
70
|
var AuthFormError_1 = require("../auth/AuthFormError");
|
|
71
71
|
var AuthMessagePanel_1 = require("../auth/AuthMessagePanel");
|
|
72
72
|
var AuthApi_1 = require("../auth/AuthApi");
|
|
73
|
+
var AuthFormFields_1 = require("../auth/AuthFormFields");
|
|
74
|
+
var AuthValidation_1 = require("../auth/AuthValidation");
|
|
73
75
|
var ForgotPasswordComponent = function () {
|
|
74
|
-
var _a = (0, react_1.useState)(
|
|
76
|
+
var _a = (0, react_1.useState)({}), fieldErrors = _a[0], setFieldErrors = _a[1];
|
|
75
77
|
var _b = (0, react_1.useState)(), error = _b[0], setError = _b[1];
|
|
76
78
|
var _c = (0, react_1.useState)(false), busy = _c[0], setBusy = _c[1];
|
|
77
79
|
var _d = (0, react_1.useState)(false), sent = _d[0], setSent = _d[1];
|
|
78
80
|
var onSubmit = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
-
var error_1;
|
|
81
|
+
var form, email, invalid, error_1;
|
|
80
82
|
return __generator(this, function (_a) {
|
|
81
83
|
switch (_a.label) {
|
|
82
84
|
case 0:
|
|
83
85
|
event.preventDefault();
|
|
86
|
+
form = event.currentTarget;
|
|
87
|
+
email = AuthFormFields_1.AuthFormFields.read(form, ['email']).email;
|
|
88
|
+
invalid = AuthValidation_1.AuthValidation.forgotPassword({ email: email });
|
|
89
|
+
setFieldErrors(invalid !== null && invalid !== void 0 ? invalid : {});
|
|
90
|
+
if (invalid) {
|
|
91
|
+
AuthFormFields_1.AuthFormFields.focusFirstInvalid(form, invalid);
|
|
92
|
+
return [2 /*return*/];
|
|
93
|
+
}
|
|
84
94
|
setError(undefined);
|
|
85
95
|
setBusy(true);
|
|
86
96
|
_a.label = 1;
|
|
87
97
|
case 1:
|
|
88
98
|
_a.trys.push([1, 3, , 4]);
|
|
89
|
-
return [4 /*yield*/, new AuthApi_1.AuthApi().initiatePasswordReset(email)];
|
|
99
|
+
return [4 /*yield*/, new AuthApi_1.AuthApi().initiatePasswordReset(email.trim())];
|
|
90
100
|
case 2:
|
|
91
101
|
_a.sent();
|
|
92
102
|
setSent(true);
|
|
@@ -108,7 +118,7 @@ var ForgotPasswordComponent = function () {
|
|
|
108
118
|
react_1.default.createElement("title", null, "Reset your password")),
|
|
109
119
|
react_1.default.createElement(AuthLayout_1.AuthLayout, { title: 'Reset your password', subtitle: "Enter your email and we'll send you a link to reset your password." },
|
|
110
120
|
react_1.default.createElement("form", { onSubmit: onSubmit, noValidate: true },
|
|
111
|
-
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Email',
|
|
121
|
+
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Email', name: 'email', onChange: function () { return setFieldErrors(function (errors) { return (errors.email ? {} : errors); }); }, error: fieldErrors.email, type: 'email', autoComplete: 'username', disabled: busy }),
|
|
112
122
|
react_1.default.createElement(AuthFormError_1.AuthFormError, { message: error }),
|
|
113
123
|
react_1.default.createElement(AuthButton_1.AuthButton, { busy: busy }, "Send reset link")),
|
|
114
124
|
react_1.default.createElement(material_1.Box, { sx: { display: 'flex', justifyContent: 'center', mt: 3 } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgotPassword.js","sourceRoot":"","sources":["../../../src/pages/ForgotPassword.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,0CAA0C;AAE1C,wCAA2C;AAC3C,6CAAsC;AACtC,iDAAgD;AAChD,uDAAsD;AACtD,iDAAgD;AAChD,uDAAsD;AACtD,6DAA4D;AAC5D,2CAA0C;
|
|
1
|
+
{"version":3,"file":"ForgotPassword.js","sourceRoot":"","sources":["../../../src/pages/ForgotPassword.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,0CAA0C;AAE1C,wCAA2C;AAC3C,6CAAsC;AACtC,iDAAgD;AAChD,uDAAsD;AACtD,iDAAgD;AAChD,uDAAsD;AACtD,6DAA4D;AAC5D,2CAA0C;AAC1C,yDAAwD;AACxD,yDAAyE;AAEzE,IAAM,uBAAuB,GAAa;IAClC,IAAA,KAAgC,IAAA,gBAAQ,EAA2B,EAAE,CAAC,EAArE,WAAW,QAAA,EAAE,cAAc,QAA0C,CAAC;IACvE,IAAA,KAAoB,I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IAAI,EAAE;QACJ,MAAM,EAAE,IAAI;KACb;IACD,SAAS,EAAE,uBAAuB;CACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Login.d.ts","sourceRoot":"","sources":["../../../src/pages/Login.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Login.d.ts","sourceRoot":"","sources":["../../../src/pages/Login.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AA+FrC,eAAO,MAAM,SAAS,EAAE,IAOvB,CAAC"}
|
package/dist/src/pages/Login.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -69,29 +80,44 @@ var AuthTextField_1 = require("../auth/AuthTextField");
|
|
|
69
80
|
var AuthButton_1 = require("../auth/AuthButton");
|
|
70
81
|
var AuthFormError_1 = require("../auth/AuthFormError");
|
|
71
82
|
var AuthApi_1 = require("../auth/AuthApi");
|
|
83
|
+
var AuthFormFields_1 = require("../auth/AuthFormFields");
|
|
84
|
+
var AuthValidation_1 = require("../auth/AuthValidation");
|
|
72
85
|
var LoginComponent = function () {
|
|
73
|
-
var _a = (0, react_1.useState)(
|
|
74
|
-
var _b = (0, react_1.useState)(
|
|
75
|
-
var _c = (0, react_1.useState)(),
|
|
76
|
-
var
|
|
86
|
+
var _a = (0, react_1.useState)({}), fieldErrors = _a[0], setFieldErrors = _a[1];
|
|
87
|
+
var _b = (0, react_1.useState)(), error = _b[0], setError = _b[1];
|
|
88
|
+
var _c = (0, react_1.useState)(false), busy = _c[0], setBusy = _c[1];
|
|
89
|
+
var clearFieldError = function (name) {
|
|
90
|
+
return setFieldErrors(function (errors) {
|
|
91
|
+
var _a;
|
|
92
|
+
return (errors[name] ? __assign(__assign({}, errors), (_a = {}, _a[name] = undefined, _a)) : errors);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
77
95
|
var onSubmit = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
78
|
-
var error_1;
|
|
79
|
-
return __generator(this, function (
|
|
80
|
-
switch (
|
|
96
|
+
var form, _a, email, password, invalid, error_1;
|
|
97
|
+
return __generator(this, function (_b) {
|
|
98
|
+
switch (_b.label) {
|
|
81
99
|
case 0:
|
|
82
100
|
event.preventDefault();
|
|
101
|
+
form = event.currentTarget;
|
|
102
|
+
_a = AuthFormFields_1.AuthFormFields.read(form, ['email', 'password']), email = _a.email, password = _a.password;
|
|
103
|
+
invalid = AuthValidation_1.AuthValidation.login({ email: email, password: password });
|
|
104
|
+
setFieldErrors(invalid !== null && invalid !== void 0 ? invalid : {});
|
|
105
|
+
if (invalid) {
|
|
106
|
+
AuthFormFields_1.AuthFormFields.focusFirstInvalid(form, invalid);
|
|
107
|
+
return [2 /*return*/];
|
|
108
|
+
}
|
|
83
109
|
setError(undefined);
|
|
84
110
|
setBusy(true);
|
|
85
|
-
|
|
111
|
+
_b.label = 1;
|
|
86
112
|
case 1:
|
|
87
|
-
|
|
88
|
-
return [4 /*yield*/, new AuthApi_1.AuthApi().login(email, password)];
|
|
113
|
+
_b.trys.push([1, 3, , 4]);
|
|
114
|
+
return [4 /*yield*/, new AuthApi_1.AuthApi().login(email.trim(), password)];
|
|
89
115
|
case 2:
|
|
90
|
-
|
|
116
|
+
_b.sent();
|
|
91
117
|
window.location.href = '/';
|
|
92
118
|
return [3 /*break*/, 4];
|
|
93
119
|
case 3:
|
|
94
|
-
error_1 =
|
|
120
|
+
error_1 = _b.sent();
|
|
95
121
|
setError(error_1.message);
|
|
96
122
|
setBusy(false);
|
|
97
123
|
return [3 /*break*/, 4];
|
|
@@ -104,8 +130,8 @@ var LoginComponent = function () {
|
|
|
104
130
|
react_1.default.createElement("title", null, "Log in")),
|
|
105
131
|
react_1.default.createElement(AuthLayout_1.AuthLayout, { title: 'Log in' },
|
|
106
132
|
react_1.default.createElement("form", { onSubmit: onSubmit, noValidate: true },
|
|
107
|
-
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Email',
|
|
108
|
-
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Password',
|
|
133
|
+
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Email', name: 'email', onChange: function () { return clearFieldError('email'); }, error: fieldErrors.email, type: 'email', autoComplete: 'username', disabled: busy }),
|
|
134
|
+
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Password', name: 'password', onChange: function () { return clearFieldError('password'); }, error: fieldErrors.password, password: true, autoComplete: 'current-password', disabled: busy }),
|
|
109
135
|
react_1.default.createElement(AuthFormError_1.AuthFormError, { message: error }),
|
|
110
136
|
react_1.default.createElement(AuthButton_1.AuthButton, { busy: busy }, "Log in")),
|
|
111
137
|
react_1.default.createElement(material_1.Box, { sx: { display: 'flex', justifyContent: 'center', mt: 3 } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Login.js","sourceRoot":"","sources":["../../../src/pages/Login.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Login.js","sourceRoot":"","sources":["../../../src/pages/Login.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Ac,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE;gBAC3D,8BAAC,eAAI,IACH,IAAI,EAAE,WAAI,eAAQ,CAAC,IAAI,CAAC,cAAc,CAAE,EACxC,SAAS,EAAC,OAAO,EACjB,EAAE,EAAE;wBACF,QAAQ,EAAE,UAAU;wBACpB,KAAK,EAAE,gBAAgB;wBACvB,yCAAyC;wBACzC,EAAE,EAAE,MAAM;wBACV,EAAE,EAAE,CAAC;qBACN,uBAGI,CACH,CACK,CACZ,CACJ,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,SAAS,GAAS;IAC7B,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,eAAQ,CAAC,IAAI,CAAC,KAAK;IACzB,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI;KACb;IACD,SAAS,EAAE,cAAc;CAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordReset.d.ts","sourceRoot":"","sources":["../../../src/pages/PasswordReset.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"PasswordReset.d.ts","sourceRoot":"","sources":["../../../src/pages/PasswordReset.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAmKrC,eAAO,MAAM,iBAAiB,EAAE,IAO/B,CAAC"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -70,6 +81,7 @@ var AuthButton_1 = require("../auth/AuthButton");
|
|
|
70
81
|
var AuthFormError_1 = require("../auth/AuthFormError");
|
|
71
82
|
var AuthMessagePanel_1 = require("../auth/AuthMessagePanel");
|
|
72
83
|
var AuthApi_1 = require("../auth/AuthApi");
|
|
84
|
+
var AuthFormFields_1 = require("../auth/AuthFormFields");
|
|
73
85
|
var AuthValidation_1 = require("../auth/AuthValidation");
|
|
74
86
|
function resetTokenFromUrl() {
|
|
75
87
|
if (typeof window === 'undefined') {
|
|
@@ -84,11 +96,10 @@ var PasswordResetComponent = function () {
|
|
|
84
96
|
var _a = (0, react_1.useState)(!!token), validating = _a[0], setValidating = _a[1];
|
|
85
97
|
var _b = (0, react_1.useState)(!token), invalid = _b[0], setInvalid = _b[1];
|
|
86
98
|
var _c = (0, react_1.useState)(''), email = _c[0], setEmail = _c[1];
|
|
87
|
-
var _d = (0, react_1.useState)(
|
|
88
|
-
var _e = (0, react_1.useState)(
|
|
89
|
-
var _f = (0, react_1.useState)(),
|
|
90
|
-
var _g = (0, react_1.useState)(false),
|
|
91
|
-
var _h = (0, react_1.useState)(false), resetComplete = _h[0], setResetComplete = _h[1];
|
|
99
|
+
var _d = (0, react_1.useState)({}), fieldErrors = _d[0], setFieldErrors = _d[1];
|
|
100
|
+
var _e = (0, react_1.useState)(), error = _e[0], setError = _e[1];
|
|
101
|
+
var _f = (0, react_1.useState)(false), busy = _f[0], setBusy = _f[1];
|
|
102
|
+
var _g = (0, react_1.useState)(false), resetComplete = _g[0], setResetComplete = _g[1];
|
|
92
103
|
(0, react_1.useEffect)(function () {
|
|
93
104
|
if (!token) {
|
|
94
105
|
return;
|
|
@@ -121,29 +132,38 @@ var PasswordResetComponent = function () {
|
|
|
121
132
|
active = false;
|
|
122
133
|
};
|
|
123
134
|
}, [token]);
|
|
135
|
+
var clearFieldError = function (name) {
|
|
136
|
+
return setFieldErrors(function (errors) {
|
|
137
|
+
var _a;
|
|
138
|
+
return (errors[name] ? __assign(__assign({}, errors), (_a = {}, _a[name] = undefined, _a)) : errors);
|
|
139
|
+
});
|
|
140
|
+
};
|
|
124
141
|
var onSubmit = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
-
var
|
|
126
|
-
return __generator(this, function (
|
|
127
|
-
switch (
|
|
142
|
+
var form, _a, newPassword, confirmPassword, invalid, error_1;
|
|
143
|
+
return __generator(this, function (_b) {
|
|
144
|
+
switch (_b.label) {
|
|
128
145
|
case 0:
|
|
129
146
|
event.preventDefault();
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
147
|
+
form = event.currentTarget;
|
|
148
|
+
_a = AuthFormFields_1.AuthFormFields.read(form, ['newPassword', 'confirmPassword']), newPassword = _a.newPassword, confirmPassword = _a.confirmPassword;
|
|
149
|
+
invalid = AuthValidation_1.AuthValidation.passwordReset({ newPassword: newPassword, confirmPassword: confirmPassword });
|
|
150
|
+
setFieldErrors(invalid !== null && invalid !== void 0 ? invalid : {});
|
|
151
|
+
if (invalid) {
|
|
152
|
+
AuthFormFields_1.AuthFormFields.focusFirstInvalid(form, invalid);
|
|
133
153
|
return [2 /*return*/];
|
|
134
154
|
}
|
|
135
155
|
setError(undefined);
|
|
136
156
|
setBusy(true);
|
|
137
|
-
|
|
157
|
+
_b.label = 1;
|
|
138
158
|
case 1:
|
|
139
|
-
|
|
159
|
+
_b.trys.push([1, 3, , 4]);
|
|
140
160
|
return [4 /*yield*/, new AuthApi_1.AuthApi().executePasswordReset(token, newPassword)];
|
|
141
161
|
case 2:
|
|
142
|
-
|
|
162
|
+
_b.sent();
|
|
143
163
|
setResetComplete(true);
|
|
144
164
|
return [3 /*break*/, 4];
|
|
145
165
|
case 3:
|
|
146
|
-
error_1 =
|
|
166
|
+
error_1 = _b.sent();
|
|
147
167
|
setError(error_1.message);
|
|
148
168
|
setBusy(false);
|
|
149
169
|
return [3 /*break*/, 4];
|
|
@@ -169,8 +189,8 @@ var PasswordResetComponent = function () {
|
|
|
169
189
|
react_1.default.createElement(AuthLayout_1.AuthLayout, { title: 'Choose a new password' },
|
|
170
190
|
react_1.default.createElement("form", { onSubmit: onSubmit, noValidate: true },
|
|
171
191
|
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Email', value: email, type: 'email', autoComplete: 'username', readOnly: true }),
|
|
172
|
-
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'New password',
|
|
173
|
-
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Confirm new password',
|
|
192
|
+
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'New password', name: 'newPassword', onChange: function () { return clearFieldError('newPassword'); }, error: fieldErrors.newPassword, password: true, autoComplete: 'new-password', disabled: busy }),
|
|
193
|
+
react_1.default.createElement(AuthTextField_1.AuthTextField, { label: 'Confirm new password', name: 'confirmPassword', onChange: function () { return clearFieldError('confirmPassword'); }, error: fieldErrors.confirmPassword, password: true, autoComplete: 'new-password', disabled: busy }),
|
|
174
194
|
react_1.default.createElement(AuthFormError_1.AuthFormError, { message: error }),
|
|
175
195
|
react_1.default.createElement(AuthButton_1.AuthButton, { busy: busy }, "Reset password")))));
|
|
176
196
|
};
|