|
|
@@ -114,12 +114,70 @@ app.post("/nauth/reSendCodeSMSOTP", async (req, res) => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-app.post("/nauth/resetNewPassword", async (req, res) => {
|
|
|
- await coreClient.NAuth.resetNewPassword({
|
|
|
- newPassword: req.body.newPassword,
|
|
|
- mail: req.body.mail,
|
|
|
- code: req.body.code
|
|
|
- }).then((resp) => {
|
|
|
+app.post("/nauth/startResetPassword", async (req, res) => {
|
|
|
+ let params = {
|
|
|
+ };
|
|
|
+
|
|
|
+ if (req.body.mail) {
|
|
|
+ params.mail = req.body.mail;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.userName) {
|
|
|
+ params.userName = req.body.userName;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.phone) {
|
|
|
+ const phone = {
|
|
|
+ phoneAreaCode: req.body.phoneAreaCode,
|
|
|
+ phone: req.body.phone
|
|
|
+ }
|
|
|
+ params.phone = phone;
|
|
|
+ }
|
|
|
+
|
|
|
+ await coreClient.NAuth.startResetPassword(params)
|
|
|
+ .then((resp) => {
|
|
|
+ res.status(200).json(resp);
|
|
|
+ }).catch((err) => {
|
|
|
+ console.log("err:", err)
|
|
|
+ res.status(400).json("something-went-wrong");
|
|
|
+ });
|
|
|
+});
|
|
|
+
|
|
|
+app.post("/nauth/confirmResetPasswordMethod", async (req, res) => {
|
|
|
+ let params = {
|
|
|
+ method: req.body.method
|
|
|
+ };
|
|
|
+
|
|
|
+ if (req.body.userName) {
|
|
|
+ params.userName = req.body.userName;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.mail) {
|
|
|
+ params.mail = req.body.mail;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.phone) {
|
|
|
+ const phone = {
|
|
|
+ phoneAreaCode: req.body.phoneAreaCode,
|
|
|
+ phone: req.body.phone
|
|
|
+ }
|
|
|
+ params.phone = phone;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.targetMail) {
|
|
|
+ params.targetMail = req.body.targetMail;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.targetPhone) {
|
|
|
+ const target = {
|
|
|
+ phoneAreaCode: req.body.targetPhoneAreaCode,
|
|
|
+ phone: req.body.targetPhone
|
|
|
+ }
|
|
|
+ params.targetPhone = target
|
|
|
+ }
|
|
|
+
|
|
|
+ await coreClient.NAuth.confirmResetPasswordMethod(params)
|
|
|
+ .then((resp) => {
|
|
|
res.status(200).json(resp);
|
|
|
}).catch((err) => {
|
|
|
console.log("err:", err)
|
|
|
@@ -128,10 +186,28 @@ app.post("/nauth/resetNewPassword", async (req, res) => {
|
|
|
});
|
|
|
|
|
|
app.post("/nauth/resetPasswordCheckCode", async (req, res) => {
|
|
|
- await coreClient.NAuth.resetPasswordCheckCode({
|
|
|
- mail: req.body.mail,
|
|
|
+ let params = {
|
|
|
code: req.body.code
|
|
|
- }).then((resp) => {
|
|
|
+ };
|
|
|
+
|
|
|
+ if (req.body.mail) {
|
|
|
+ params.mail = req.body.mail;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.userName) {
|
|
|
+ params.userName = req.body.userName;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.phone) {
|
|
|
+ const phone = {
|
|
|
+ phoneAreaCode: req.body.phoneAreaCode,
|
|
|
+ phone: req.body.phone
|
|
|
+ }
|
|
|
+ params.phone = phone;
|
|
|
+ }
|
|
|
+
|
|
|
+ await coreClient.NAuth.resetPasswordCheckCode(params)
|
|
|
+ .then((resp) => {
|
|
|
res.status(200).json(resp);
|
|
|
}).catch((err) => {
|
|
|
console.log("err:", err)
|
|
|
@@ -139,11 +215,30 @@ app.post("/nauth/resetPasswordCheckCode", async (req, res) => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-app.post("/nauth/smsOTP", async (req, res) => {
|
|
|
- await coreClient.NAuth.smsOTP({
|
|
|
- mail: req.body.mail,
|
|
|
+app.post("/nauth/resetNewPassword", async (req, res) => {
|
|
|
+ let params = {
|
|
|
+ newPassword: req.body.newPassword,
|
|
|
code: req.body.code
|
|
|
- }).then((resp) => {
|
|
|
+ };
|
|
|
+
|
|
|
+ if (req.body.mail) {
|
|
|
+ params.mail = req.body.mail;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.userName) {
|
|
|
+ params.userName = req.body.userName;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.body.phone) {
|
|
|
+ const phone = {
|
|
|
+ phoneAreaCode: req.body.phoneAreaCode,
|
|
|
+ phone: req.body.phone
|
|
|
+ }
|
|
|
+ params.phone = phone;
|
|
|
+ }
|
|
|
+
|
|
|
+ await coreClient.NAuth.resetNewPassword(params)
|
|
|
+ .then((resp) => {
|
|
|
res.status(200).json(resp);
|
|
|
}).catch((err) => {
|
|
|
console.log("err:", err)
|
|
|
@@ -151,9 +246,10 @@ app.post("/nauth/smsOTP", async (req, res) => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-app.post("/nauth/startMailVerify", async (req, res) => {
|
|
|
- await coreClient.NAuth.startMailVerify({
|
|
|
- mail: req.body.mail
|
|
|
+app.post("/nauth/smsOTP", async (req, res) => {
|
|
|
+ await coreClient.NAuth.smsOTP({
|
|
|
+ mail: req.body.mail,
|
|
|
+ code: req.body.code
|
|
|
}).then((resp) => {
|
|
|
res.status(200).json(resp);
|
|
|
}).catch((err) => {
|
|
|
@@ -162,8 +258,8 @@ app.post("/nauth/startMailVerify", async (req, res) => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-app.post("/nauth/startResetPassword", async (req, res) => {
|
|
|
- await coreClient.NAuth.startResetPassword({
|
|
|
+app.post("/nauth/startMailVerify", async (req, res) => {
|
|
|
+ await coreClient.NAuth.startMailVerify({
|
|
|
mail: req.body.mail
|
|
|
}).then((resp) => {
|
|
|
res.status(200).json(resp);
|
|
|
@@ -264,6 +360,40 @@ app.get("/nchar/getPastUserNameChanges", async (req, res) => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+app.post("/nchar/editUserProfile", async (req, res) => {
|
|
|
+ let params = {};
|
|
|
+ if (req.body.firstName) params.firstName = req.body.firstName;
|
|
|
+ if (req.body.lastName) params.lastName = req.body.lastName;
|
|
|
+ await coreClient.NChar.editUserProfile(params).then((resp) => {
|
|
|
+ res.status(200).json(resp);
|
|
|
+ }).catch((err) => {
|
|
|
+ console.log("err:", err)
|
|
|
+ res.status(400).json("something-went-wrong");
|
|
|
+ });
|
|
|
+});
|
|
|
+
|
|
|
+app.post("/nchar/addMail", async (req, res) => {
|
|
|
+ await coreClient.NChar.addMail({
|
|
|
+ mail: req.body.mail
|
|
|
+ }).then((resp) => {
|
|
|
+ res.status(200).json(resp);
|
|
|
+ }).catch((err) => {
|
|
|
+ console.log("err:", err)
|
|
|
+ res.status(400).json("something-went-wrong");
|
|
|
+ });
|
|
|
+});
|
|
|
+
|
|
|
+app.post("/nchar/deleteMail", async (req, res) => {
|
|
|
+ await coreClient.NChar.deleteMail({
|
|
|
+ mail: req.body.mail
|
|
|
+ }).then((resp) => {
|
|
|
+ res.status(200).json(resp);
|
|
|
+ }).catch((err) => {
|
|
|
+ console.log("err:", err)
|
|
|
+ res.status(400).json("something-went-wrong");
|
|
|
+ });
|
|
|
+});
|
|
|
+
|
|
|
const PORT = process.env.PORT || 5000;
|
|
|
|
|
|
app.listen(PORT, () => {
|