Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- There are two issues I am seeing working on section 31: Authentication Lecture 240....
- 1. Login form redirects to itself even a good user account and password is used.
- 2. URL of the login page shows name value pairs-- eg ?username=alex&password=something
- which i am assuming is not good for any site.
- ++++++++++++++++++++++++++
- app.JS code
- +++++++++++++++++++++++++
- passport.use(new localStrategy(User.authenticate()));
- passport.serializeUser(User.serializeUser());
- passport.deserializeUser(User.deserializeUser());
- // More code and other routes here.
- // LOGIN ROUTES
- // Render login form
- app.get("/login", function(req, res) {
- res.render("login");
- });
- // LOGIN LOGIC
- app.post("/login", passport.authenticate("local", {
- successRedirect: "/secret",
- failureRedirect: "/login"
- }) , function(req, res) {
- });
- +++++++++++++++++++++++
- login.ejs
- +++++++++++++++++++++++
- <h1>LOGIN</h1>
- <form action="/login" method "POST">
- <input type="text" name="username" placeholder="username">
- <input type="password" name="password" placeholder="password">
- <button>Login</button>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement