Skip to content

Commit b75ad9a

Browse files
committed
login message should be after checking if user exists
1 parent e059f0f commit b75ad9a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

config/authConfig.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ const localStrat = new LocalStrategy(async (username, password, done) => {
99
"SELECT * FROM account WHERE username = $1",
1010
[username]
1111
);
12+
console.log(username);
1213
const user = rows[0];
13-
14-
const match = await bcrypt.compare(password, user.password);
14+
console.log(user);
1515

1616
if (!user) {
1717
return done(null, false, { message: "Incorrect username" });
1818
}
19+
20+
const match = await bcrypt.compare(password, user.password);
1921
if (!match) {
2022
return done(null, false, { message: "Incorrect password" });
2123
}

views/showPosts.ejs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<%- include('partials/header') %>
88
</body>
99
<main>
10+
<div>
11+
<a href="/create-post">create a new post</a>
12+
</div>
1013
<% if (locals.postList) {%>
1114
<ul>
1215
<% postList.forEach(post => { %>

0 commit comments

Comments
 (0)