91 "dis_loop_boyutu",
92];
93
94const upload = async (req, res) => { 95 try {
96 if (req.file == undefined) {
97 return res.status(400).json({
108 res.status(200).send({ message: "Password reset email sent" });
109 });
110};
111exports.resetPassword = async (req, res) => {112 // Get the token and new password from the request body
113 const { email, password, securitycode } = req.body;
114
97 text: `Güvenlik Kodu (5 dakika için geçerli) : ${token}`,
98 };
99
100 transporter.sendMail(mailOptions, (error, info) => {101 if (error) {
102 console.log(error);
103 return res
54};
55
56// Function to handle forgot password request
57exports.forgotPassword = async (req, res) => { 58 // Get the email from the request body
59 const { email } = req.body;
60
2const fs = require("fs");
3const path = require("path");
4
5const excelFilter = (req, file, cb) => { 6 if (
7 fs.existsSync(path.join(__basedir + "/app/uploads/", file.originalname))
8 ) {
Any code paths that do not have explicit returns will return undefined
.
It is recommended to replace any implicit dead-ends that return undefined
with a return null
statement.
As a convention, undefined
signals that an unexpected value has been produced as the
result of a logical error in the program.
A null
return, on the other hand, signals that the input to a function was incorrect,
or a value was 'not found'.
Having this distinction in code helps you figure out if something was caused because of a logical error, or malformed input to a function call.
function getUser(name) {
if (userExists(name)) {
return userDb.get(name);
}
// whoops! Implicit undefined return
}
function readFile(fileName) {
if (fs.existsSync(fileName)) {
return fs.readFileSync(fileName, 'utf-8');
}
return; // Implicit undefined return.
}
function getUser(name) {
if (userExists(name)) {
return userDb.get(name);
}
// `null` indicates there is no such user.
return null;
}
function readFile(fileName) {
if (fs.existsSync(fileName)) {
return fs.readFileSync(fileName, 'utf-8');
}
// `null` indicates there is no such file.
return null;
}