authscape-usermanagement 1.0.14 → 1.0.16

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/index.js CHANGED
@@ -45,7 +45,9 @@ function UserEditor(_ref) {
45
45
  _ref$customFields = _ref.customFields,
46
46
  customFields = _ref$customFields === void 0 ? null : _ref$customFields,
47
47
  _ref$onSaved = _ref.onSaved,
48
- onSaved = _ref$onSaved === void 0 ? null : _ref$onSaved;
48
+ onSaved = _ref$onSaved === void 0 ? null : _ref$onSaved,
49
+ _ref$onPasswordChange = _ref.onPasswordChanged,
50
+ onPasswordChanged = _ref$onPasswordChange === void 0 ? null : _ref$onPasswordChange;
49
51
  var _useForm = (0, _reactHookForm.useForm)(),
50
52
  control = _useForm.control,
51
53
  register = _useForm.register,
@@ -747,11 +749,26 @@ function UserEditor(_ref) {
747
749
  });
748
750
  case 3:
749
751
  response = _context6.sent;
750
- if (response != null && response.status == 200) {
751
- alert("Password Changed!");
752
- } else {
753
- alert(JSON.stringify(response.data.error));
752
+ if (onPasswordChanged != null) {
753
+ onPasswordChanged(response);
754
754
  }
755
+ // if (response != null && response.status == 200)
756
+ // {
757
+ // if (response.data == null)
758
+ // {
759
+
760
+ // }
761
+ // else
762
+ // {
763
+
764
+ // }
765
+
766
+ // alert("Password Changed!");
767
+ // }
768
+ // else
769
+ // {
770
+ // alert(JSON.stringify(response.data.error));
771
+ // }
755
772
  case 5:
756
773
  case "end":
757
774
  return _context6.stop();
@@ -808,7 +825,9 @@ function UserManagement(_ref) {
808
825
  _ref$height = _ref.height,
809
826
  height = _ref$height === void 0 ? "50vh" : _ref$height,
810
827
  _ref$onUploadComplete = _ref.onUploadCompleted,
811
- _onUploadCompleted = _ref$onUploadComplete === void 0 ? null : _ref$onUploadComplete;
828
+ _onUploadCompleted = _ref$onUploadComplete === void 0 ? null : _ref$onUploadComplete,
829
+ _ref$onPasswordChange = _ref.onPasswordChanged,
830
+ onPasswordChanged = _ref$onPasswordChange === void 0 ? null : _ref$onPasswordChange;
812
831
  var _useState = (0, _react.useState)(null),
813
832
  _useState2 = _slicedToArray(_useState, 2),
814
833
  showUserDetails = _useState2[0],
@@ -992,6 +1011,7 @@ function UserManagement(_ref) {
992
1011
  }, /*#__PURE__*/_react["default"].createElement(UserEditor, {
993
1012
  userId: showUserDetails,
994
1013
  customFields: customFields,
1014
+ onPasswordChanged: onPasswordChanged,
995
1015
  onSaved: function onSaved() {
996
1016
  setDataGridRefreshKey(dataGridRefreshKey + 1);
997
1017
  setShowUserDetails(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape-usermanagement",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/UserEditor.js CHANGED
@@ -17,7 +17,7 @@ import { Tab, Tabs } from '@mui/material';
17
17
  import BusinessRoundedIcon from '@mui/icons-material/BusinessRounded';
18
18
  import { apiService } from 'authscape';
19
19
 
20
- export function UserEditor({userId = null, customFields = null, onSaved = null}) {
20
+ export function UserEditor({userId = null, customFields = null, onSaved = null, onPasswordChanged = null}) {
21
21
 
22
22
  const {control, register, handleSubmit, formState: { errors }, watch, setValue } = useForm();
23
23
 
@@ -612,15 +612,27 @@ export function UserEditor({userId = null, customFields = null, onSaved = null})
612
612
  password: newPassword
613
613
  });
614
614
 
615
- if (response != null && response.status == 200)
615
+ if (onPasswordChanged != null)
616
616
  {
617
- alert("Password Changed!");
617
+ onPasswordChanged(response);
618
618
  }
619
- else
620
- {
621
- alert(JSON.stringify(response.data.error));
622
- }
623
-
619
+ // if (response != null && response.status == 200)
620
+ // {
621
+ // if (response.data == null)
622
+ // {
623
+
624
+ // }
625
+ // else
626
+ // {
627
+
628
+ // }
629
+
630
+ // alert("Password Changed!");
631
+ // }
632
+ // else
633
+ // {
634
+ // alert(JSON.stringify(response.data.error));
635
+ // }
624
636
 
625
637
  }
626
638
 
@@ -12,7 +12,7 @@ import DialogTitle from '@mui/material/DialogTitle';
12
12
  import { EditableDatagrid, FileUploader, AutoSaveTextField } from 'authscape';
13
13
  // import { UserEditor } from './UserEditor'; // remove when done
14
14
 
15
- export default function UserManagement({customFields = null, height = "50vh", onUploadCompleted = null}) {
15
+ export default function UserManagement({customFields = null, height = "50vh", onUploadCompleted = null, onPasswordChanged = null}) {
16
16
 
17
17
  const [showUserDetails, setShowUserDetails] = useState(null);
18
18
 
@@ -156,7 +156,8 @@ export default function UserManagement({customFields = null, height = "50vh", on
156
156
 
157
157
  <UserEditor
158
158
  userId={showUserDetails}
159
- customFields={customFields}
159
+ customFields={customFields}
160
+ onPasswordChanged={onPasswordChanged}
160
161
  onSaved={() => {
161
162
 
162
163
  setDataGridRefreshKey(dataGridRefreshKey + 1);