jcc-express-mvc 1.1.3 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jcc-express-mvc",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "express mvc structure",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/Auth/index.js CHANGED
@@ -61,7 +61,8 @@ class Auth {
61
61
  attempt(req, res, next) {
62
62
  try {
63
63
  let redirectBack = req.previsiousUrls[1];
64
- const redirectPath = `/${req.session["appRedirect"]}` || "/home";
64
+ const appRedirect = req.session["appRedirect"];
65
+ const redirectPath = appRedirect ? appRedirect : "/home";
65
66
  return passport.authenticate("local", {
66
67
  successRedirect: redirectPath,
67
68
  failureRedirect: `${redirectBack ? redirectBack : "/login"}`,
@@ -18,15 +18,14 @@ module.exports = (passport) => {
18
18
  }
19
19
  const isMatch = await verifyHash(password, user.password);
20
20
  if (isMatch) {
21
- // console.log("Match");
22
21
  return done(null, user);
23
22
  }
24
23
  return done(null, false, { message: "Invalid credentials" });
25
24
  } catch (error) {
26
25
  console.log({ passportError: error.message });
27
26
  }
28
- }
29
- )
27
+ },
28
+ ),
30
29
  );
31
30
 
32
31
  passport.serializeUser((user, done) => done(null, user.id));
@@ -66,7 +66,7 @@ class ValidationMethod {
66
66
  return validator.default.equals(firstValue, secondValue)
67
67
  ? false
68
68
  : `${capitalize(firstFieldName)} did not match with ${capitalize(
69
- secondFieldName
69
+ secondFieldName,
70
70
  )}`;
71
71
  }
72
72
 
@@ -102,7 +102,6 @@ class ValidationMethod {
102
102
 
103
103
  async unqiue(fieldName, fieldValue, model) {
104
104
  try {
105
- console.log(fieldName);
106
105
  let modelName = getModel(`${capitalize(model)}`);
107
106
  return (await modelName.findOne({ [fieldName]: fieldValue }))
108
107
  ? `${capitalize(fieldName)} already exist`