idea-aws 4.4.16 → 4.4.18
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/src/cognito.d.ts +5 -1
- package/dist/src/cognito.js +15 -3
- package/package.json +1 -1
package/dist/src/cognito.d.ts
CHANGED
|
@@ -80,7 +80,11 @@ export declare class Cognito {
|
|
|
80
80
|
/**
|
|
81
81
|
* Change the email address (== username) associated to a user.
|
|
82
82
|
*/
|
|
83
|
-
updateEmail(email: string, newEmail: string, userPoolId: string): Promise<void>;
|
|
83
|
+
updateEmail(email: string, newEmail: string, userPoolId: string, globalSignOut?: boolean): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Verify the email address (== username) associated to a user.
|
|
86
|
+
*/
|
|
87
|
+
verifyEmail(email: string, userPoolId: string, unverify?: boolean): Promise<void>;
|
|
84
88
|
/**
|
|
85
89
|
* Change the password to sign in for a user.
|
|
86
90
|
*/
|
package/dist/src/cognito.js
CHANGED
|
@@ -249,7 +249,7 @@ class Cognito {
|
|
|
249
249
|
/**
|
|
250
250
|
* Change the email address (== username) associated to a user.
|
|
251
251
|
*/
|
|
252
|
-
async updateEmail(email, newEmail, userPoolId) {
|
|
252
|
+
async updateEmail(email, newEmail, userPoolId, globalSignOut = false) {
|
|
253
253
|
if ((0, idea_toolbox_1.isEmpty)(newEmail, 'email'))
|
|
254
254
|
throw new Error('Invalid new email');
|
|
255
255
|
const command = new CognitoIP.AdminUpdateUserAttributesCommand({
|
|
@@ -261,8 +261,20 @@ class Cognito {
|
|
|
261
261
|
]
|
|
262
262
|
});
|
|
263
263
|
await this.client.send(command);
|
|
264
|
-
// sign out the user from all its devices
|
|
265
|
-
|
|
264
|
+
// sign out the user from all its devices
|
|
265
|
+
if (globalSignOut)
|
|
266
|
+
await this.globalSignOut(newEmail, userPoolId);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Verify the email address (== username) associated to a user.
|
|
270
|
+
*/
|
|
271
|
+
async verifyEmail(email, userPoolId, unverify = false) {
|
|
272
|
+
const command = new CognitoIP.AdminUpdateUserAttributesCommand({
|
|
273
|
+
UserPoolId: userPoolId,
|
|
274
|
+
Username: email,
|
|
275
|
+
UserAttributes: [{ Name: 'email_verified', Value: unverify ? 'false' : 'true' }]
|
|
276
|
+
});
|
|
277
|
+
await this.client.send(command);
|
|
266
278
|
}
|
|
267
279
|
/**
|
|
268
280
|
* Change the password to sign in for a user.
|