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 +1 -1
- package/src/Auth/index.js +2 -1
- package/src/passport/config.js +2 -3
- package/src/validation/method.js +1 -2
package/package.json
CHANGED
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
|
|
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"}`,
|
package/src/passport/config.js
CHANGED
|
@@ -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));
|
package/src/validation/method.js
CHANGED
|
@@ -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`
|