Skip to content

Commit

Permalink
Merge branch 'development' of github.com:UNICEFECAR/USupport-user int…
Browse files Browse the repository at this point in the history
…o development
  • Loading branch information
georgipavlov-7DIGIT committed Feb 26, 2024
2 parents c51cca8 + 4b2a310 commit cdb497e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions service/controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,28 @@ export const generateAccessToken = async (country, language, retryStep = 0) => {

export const createEmailOTP = async ({ country, language, email }) => {

Check failure on line 168 in service/controllers/auth.js

View workflow job for this annotation

GitHub Actions / ESLint

service/controllers/auth.js#L168

'language' is defined but never used (no-unused-vars)
// Check if email is already used
await getClientUserByEmailOrAccessToken(country, email, null).then((res) => {
const isEmailUsed = await getClientUserByEmailOrAccessToken(
country,
email,
null
).then((res) => {
if (res.rowCount !== 0) {
throw emailUsed(language);
return true;
}
return false;
});

if (isEmailUsed) {
produceRaiseNotification({
channels: ["email"],
emailArgs: {
emailType: "email-used",
recipientEmail: email,
},
});
return { success: true };
}

const otp = generate4DigitCode();

await storeEmailOTP(country, email, otp)
Expand All @@ -189,7 +205,7 @@ export const createEmailOTP = async ({ country, language, email }) => {
},
});
});
return true;
return { success: true };
};

export const validatePlatformPassword = async ({
Expand Down

0 comments on commit cdb497e

Please sign in to comment.