Questions tagged [connect-flash]

Express middleware for storing messages in the session. Connect-flash was part of Express until Express 3. connect-flash

107 questions
1
vote
1 answer

req.flash() not working when rest succeed

I had a problem flashing the req.flash('success','Page Edited!'); on the admin/pages while I can easily flash req.flash('danger',"Page slug already exsists") when rerendering the page with the correspoding error. It only happens when I redirect and…
1
vote
1 answer

Express Validator Cannot Show Error Mesages

Hey guys I want to make an messaging system for my upload webpage. I use express-validator and connect-flash, express-messages app.js const { check, validationResult } = require('express-validator'); . . . app.post('/metin/ekle', [ // username…
1
vote
0 answers

flash messages don't display on the page at Nodejs

I want to send a flash message in a login Form. When the username or the password is wrong, send a flash message username/password incorrect it not showing. i try to debug console log local.error_message, that's success show username/password…
lim
  • 51
  • 1
  • 5
1
vote
1 answer

I am trying to display flash error message in express.js but req.flash('error') return empty array

Inside authControllers.js, I redirect to /signup page along with an error flash message const err = validationResult(req); //find errors and convert to array const reqErrors = err.array(); const errors = reqErrors.filter(e => e.msg…
Sean Liu
  • 831
  • 1
  • 11
  • 23
1
vote
1 answer

How to keep form data if validation fails in node.js?

I am trying to validate a form data using express validator. I have routes and controllers in separate files. I want to retain the data in the form fields after the validation has failed. I am using express validator to do the validation. Here is…
Drilldoge
  • 83
  • 7
1
vote
2 answers

How to repopulate my login form when the validation fail

I in login form when the validation is failed i am able to show the validation error messages but i am not getting how to repopulate the login form. what i want that the user should not enter his email address again in case of validation…
Uzair Khan
  • 70
  • 3
  • 12
1
vote
0 answers

Being able to use flash messages in passport even when FailureFlash = false

I have been working with passport local-strategy for a little while now and noticed that the failureFlash boolean doesnt seem too impact whether or not a flash message is shown or not. This is the code: app.post('/login',…
1
vote
0 answers

How to fix nodejs is not showing flash message

I am using express and I am making a signup page connected to mongo database, I made it that when a user types the same email as another user it flashes a message using connect-flash "Email is already in use" but it is not showing on my website,…
user10601787
1
vote
0 answers

req.flash() data persists even after refreshing the page using connect-flash

I am using connect-flash to have a flash message in my sailjs app. The flash message persists even after refreshing the page. I tried the solution on this I created a policy to clear the req.session.flash array before any request but doing that…
Tech Team
  • 109
  • 13
1
vote
1 answer

How can i fix divs from connect-flash, they are allways active(i am using pug)?

So i have this in my app.js: var flash = require('connect-flash'); app.use(flash()); app.use(function(req , res , next){ res.locals.success_messages = req.flash('success'); res.locals.error_messages = req.flash('error'); next(); }); In my…
1
vote
0 answers

Javascript - Flash messages failing to display on AJAX calls

I am developing an app where there is a searchable database of references, and there is a management app that allows a user to edit the database. The public facing side uses Knockout JS communicating with the server via a RESTful API. The…
1
vote
1 answer

passport.authenticate() does not show flash messages

Goodday, I am following [this](https://www.youtube.com/watch?v=iX8UhDOmkPE&t=682s"Login and authenticate app") tutorial. The one difference is that I am using mysql instead mongoose. when trying to login I want to flash messages. Such as "username…
1
vote
1 answer

Flash messages not showing in node.js

I can't get flash messages to turn up. Here's how I'm calling them in my routes: middlewareObj.isLoggedIn = function(req, res, next){ if(req.isAuthenticated()){ return next(); } req.flash("error", "You must be logged in to do…
thedodus
  • 9
  • 4
1
vote
0 answers

Passport.js Ajax login and flash?

I'm new to the express and passport.js and I'm very confused about how to make a ajax login with the passport.js, with no re-loading pafe but with showing flash messges. (I'm use connect-flash and express-session) Here is my…
1
vote
1 answer

Flash Message on redirect - Express

I cannot get my flash message to show when using a redirect (though all ok when using a render) If i use this code to render a view the message appears fine req.flash('success_msg', 'Successfully Registered'); res.locals.message =…
Richlewis
  • 15,070
  • 37
  • 122
  • 283