@stackfactor/client-api 1.1.112 → 1.1.114
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/lib/users.js +32 -1
- package/package.json +1 -1
package/lib/users.js
CHANGED
|
@@ -548,6 +548,34 @@ const resetPassword = (email, code, password) => {
|
|
|
548
548
|
});
|
|
549
549
|
};
|
|
550
550
|
|
|
551
|
+
/**
|
|
552
|
+
* Send email confirmation code
|
|
553
|
+
* @param {String} email
|
|
554
|
+
* @param {String} token
|
|
555
|
+
* @returns
|
|
556
|
+
*/
|
|
557
|
+
const sendEmailConfirmationCode = (email, token) => {
|
|
558
|
+
return new Promise(function (resolve, reject) {
|
|
559
|
+
let postData = {
|
|
560
|
+
email: email,
|
|
561
|
+
};
|
|
562
|
+
let request = client.post(
|
|
563
|
+
"api/v1/users/sendemailconfirmationcode",
|
|
564
|
+
postData,
|
|
565
|
+
{
|
|
566
|
+
headers: { authorization: token },
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
request
|
|
570
|
+
.then((response) => {
|
|
571
|
+
resolve(response.data);
|
|
572
|
+
})
|
|
573
|
+
.catch((error) => {
|
|
574
|
+
reject(error);
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
|
|
551
579
|
/**
|
|
552
580
|
* Send an email to the user indicated by the email address to reset the password. It returns a promise
|
|
553
581
|
* @param {String} email Email of the user who needs to reset the password
|
|
@@ -602,14 +630,16 @@ const setUserInformation = (userId, category, data, token) => {
|
|
|
602
630
|
/**
|
|
603
631
|
* Update user email
|
|
604
632
|
* @param {String} email The new email address
|
|
633
|
+
* @param {String} verificationCode The verification code
|
|
605
634
|
* @param {String} password The current password
|
|
606
635
|
* @param {String} token Authorization token
|
|
607
636
|
* @returns {Promise}
|
|
608
637
|
*/
|
|
609
|
-
const updateUserEmail = (email, password, token) => {
|
|
638
|
+
const updateUserEmail = (email, verificationCode, password, token) => {
|
|
610
639
|
return new Promise(function (resolve, reject) {
|
|
611
640
|
const requestData = {
|
|
612
641
|
email: email,
|
|
642
|
+
verificationCode: verificationCode,
|
|
613
643
|
password: password,
|
|
614
644
|
};
|
|
615
645
|
let confirmationRequest = client.post(
|
|
@@ -736,6 +766,7 @@ export default {
|
|
|
736
766
|
removeAPIToken,
|
|
737
767
|
resendInvitationEmails,
|
|
738
768
|
resetPassword,
|
|
769
|
+
sendEmailConfirmationCode,
|
|
739
770
|
sendPasswordResetNotification,
|
|
740
771
|
setUserInformation,
|
|
741
772
|
updateUserEmail,
|