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
0
votes
1 answer

req.flash is not a function - Initialization order

I am using node.js with Express 4. I have problem with connect-flash initialization. I looked at many questions with different answers and I still can't solve my problem. I tried many combinations of app.use() order and still getting TypeError…
Raold
  • 1,383
  • 4
  • 20
  • 33
0
votes
1 answer

How to send req.flash messages from node to Angular.js

I'm following a tutorial on how to set up authentication with nodejs and passport (http://scotch.io/tutorials/javascript/easy-node-authentication-setup-and-local) The tutorial has rendering templates with ejs and passing in flash info and error…
charan tej
  • 1,054
  • 10
  • 29
0
votes
1 answer

Flash message is not display on handlerbar template using node js with passport js

I am trying to show message in handlebar template using connect-flash package but message is not showing and its print count when i use {{loginMessage}} in login page. but not display message. here is my code file..routes/index.js var express = …
Raheel Aslam
  • 444
  • 1
  • 9
  • 28
0
votes
3 answers

Node - connect-flash not working on redirect

I'm running into some weird issues with connect-flash, I've used it in other projects in the exact same manner and it worked fine, here is what I have: Some Route if (err) { req.flash('message', [{ class: 'alert-danger', message:…
Mankind1023
  • 7,198
  • 16
  • 56
  • 86
0
votes
1 answer

Node&Express:req.flash() requires sessions

I have some problems with connect-flash. Here is my configuration var flash=require('connect-flash'); var session=require('express-session'); app.use(flash()); app.use(session({ secret:settings.cookieSecret, key:settings.db, …
corawang
  • 21
  • 2
0
votes
2 answers

how to use connect-flash with ajax

I have a page with a form that posts edits to a local endpoint via AJAX ($.post). I want to display a message to the user whether it went good or bad. But I can't get it to work. Here's what I have so far: jade template (excerpt) if message …
olefrank
  • 6,452
  • 14
  • 65
  • 90
0
votes
2 answers

using connect-flash with sails.js

I am trying to use connect-flash with sails.js, according to middleware documentation of sailsjs http://sailsjs.org/documentation/concepts/middleware , this is what I did passportInit : require('passport').initialize(), passportSession :…
mshahbazm
  • 611
  • 1
  • 11
  • 23
0
votes
1 answer

Flash message requires a redirect

"connect-flash": "^0.1.1", "cookie-parser": "^1.4.3", "ejs": "^2.4.2", "express": "^4.14.0", "express-session": "^1.13.0", I wrote this post request to check whether an existing username or email exist and if so it will flash a message saying…
John Anderson
  • 115
  • 10
0
votes
1 answer

Intercepting flash message

I am using Passport authentication with 'local' strategy for my application. I want the user to be able to know if the username and password entered by user is invalid and if valid then redirect to dashboard. This is how i am authenticating the…
0
votes
3 answers

sending 2 flash messages when 2 queries to the databse show that fields exist in passport configuration

On signup I check the database to see if the username and email exists if they exist it should return an error. all usernames and emails should be unique. It seems that my problem is that I could only get one error. If the email exists already I get…
jack blank
  • 5,073
  • 7
  • 41
  • 73
0
votes
1 answer

connect-flash json response using passportjs and nodejs

i tried to find a solution everywhere and had no luck. I have the Route on my nodejs api app like: app.post('/login', passport.authenticate('local-login', { successRedirect: '/profile', failureRedirect: '/login', failureFlash:…
William Xavier
  • 478
  • 3
  • 20
0
votes
0 answers

missing messange in view using connect-flash

I was using this code from this repo : https://github.com/eldyvoon/register-login-nodejs but I can't see the error message in view although the author is using connect-flash to handle the error. When u login with wrong credential for example the…
Nichole A. Miler
  • 1,281
  • 2
  • 11
  • 21
0
votes
0 answers

Using connect-flash with sequelize

I am having trouble getting connect flash to work in the sequelize callback function. router.route('/') .post(function(aRequest, aResponse) { var data = aRequest.body; models.users.findOne({ where: { …
RemeJuan
  • 823
  • 9
  • 25
0
votes
1 answer

connect-flash middleware not displaying messages

I have been trying to use the connect-flash middleware for messages but it doesnt seem to be working. I get the following error: ReferenceError: /Users/zc/Documents/tutorials/node-auth/views/addstudent.ejs:14 12| Add a new Student 13| >> 14|…
Abdi
  • 490
  • 1
  • 6
  • 17
0
votes
1 answer

Error: "Can't set headers after they are sent."

I'm new to nodejs and its routes system. I'm getting "Can't set headers after they are sent." only on production mode only on Heroku (It works fine locally). // Login ========================================= router.get('/', ifLoggedOut,…
Bahi Hussein
  • 433
  • 5
  • 10