Skip to content

Commit

Permalink
fix(api): adminCreateUser defaults status to FORCE_CHANGE_PASSWORD
Browse files Browse the repository at this point in the history
  • Loading branch information
jagregory committed Nov 25, 2021
1 parent f2f069f commit 4996aa4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/adminCreateUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe(
Enabled: true,
UserCreateDate: roundedDate,
UserLastModifiedDate: roundedDate,
UserStatus: "CONFIRMED",
UserStatus: "FORCE_CHANGE_PASSWORD",
Username: "abc",
},
});
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/listUsers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe(
Enabled: true,
UserCreateDate: createUserResult.User?.UserCreateDate,
UserLastModifiedDate: createUserResult.User?.UserLastModifiedDate,
UserStatus: "CONFIRMED",
UserStatus: "FORCE_CHANGE_PASSWORD",
Username: "abc",
},
],
Expand Down
6 changes: 5 additions & 1 deletion src/services/userPoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export interface User {
UserCreateDate: number;
UserLastModifiedDate: number;
Enabled: boolean;
UserStatus: "CONFIRMED" | "UNCONFIRMED" | "RESET_REQUIRED";
UserStatus:
| "CONFIRMED"
| "FORCE_CHANGE_PASSWORD"
| "RESET_REQUIRED"
| "UNCONFIRMED";
Attributes: AttributeListType;
MFAOptions?: MFAOptionListType;

Expand Down
2 changes: 1 addition & 1 deletion src/targets/adminCreateUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("AdminCreateUser target", () => {
Password: "pwd",
UserCreateDate: now.getTime(),
UserLastModifiedDate: now.getTime(),
UserStatus: "CONFIRMED", // TODO: this is wrong
UserStatus: "FORCE_CHANGE_PASSWORD",
Username: "user-supplied",
});
});
Expand Down
5 changes: 2 additions & 3 deletions src/targets/adminCreateUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const AdminCreateUser = ({
Password: req.TemporaryPassword,
Attributes: attributes,
Enabled: true,
UserStatus: "CONFIRMED",
UserStatus: "FORCE_CHANGE_PASSWORD",
ConfirmationCode: undefined,
UserCreateDate: now.getTime(),
UserLastModifiedDate: now.getTime(),
Expand All @@ -44,7 +44,6 @@ export const AdminCreateUser = ({
// TODO: should handle existing users
// TODO: should send a message unless MessageAction=="SUPPRESS"
// TODO: support MessageAction=="RESEND"
// TODO: UserStatus should default to FORCE_CHANGE_PASSWORD
// TODO: should generate a TemporaryPassword if one isn't set
// TODO: support ForceAliasCreation
// TODO: support PreSignIn lambda and ValidationData
Expand All @@ -54,7 +53,7 @@ export const AdminCreateUser = ({
Username: req.Username,
Attributes: attributes,
Enabled: true,
UserStatus: "CONFIRMED",
UserStatus: "FORCE_CHANGE_PASSWORD",
UserCreateDate: now,
UserLastModifiedDate: now,
MFAOptions: undefined,
Expand Down

0 comments on commit 4996aa4

Please sign in to comment.