1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
letu/sockets/email/checkResend.js

15 lines
487 B
JavaScript
Raw Permalink Normal View History

const models = require("../../models");
2020-11-02 13:43:12 +01:00
const emailCheck = require("../utils/emailCheck");
module.exports = socket => {
return async (data) => {
let user = await models.User.findByPk(data.email);
2020-11-02 13:43:12 +01:00
if (!user)
socket.emit("checkResend", {error: {message: "not_found"}});
else if (user.emailVerified)
socket.emit("checkResend", {error: {message: "verified_email"}});
else
await emailCheck(socket, user, null);
}
}