Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8382499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:56:29+00:00 2026-06-09T16:56:29+00:00

I am writing a simple application. I wrote the login/password screens, which simply set

  • 0

I am writing a simple application. I wrote the login/password screens, which simply set a session variable:

if( docs.password == req.body.password ) {
   errors.push({ field:'password', message: 'Password Match!', mustChange: false } );
   res.json( { response: 'OK' } , 200);
   req.session.loggedIn = true;
   req.session.login = req.body.login;

Once Login goes through, the client is redirected to the actual application (as per normal). However, at that point the client no longer knows what login name they used to login! (I am talking about the Javascript that runs in the browser)

As you can see, I am saving the user name in the session. However, when the client loads the “application” HTML page, they don’t have their own login name as it’s a brand new page with brand new Javascript (which is unaware of what username they used to login a moment earlier).

I could embed it somewhere in the page’s HTML (somewhere like a global JS variable in the page’s body?) since it’s in the session, but…

How is this “normally” done? What’s a good pattern to go about this?

Merc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:56:31+00:00Added an answer on June 9, 2026 at 4:56 pm

    In express 3 this is how to properly do it.
    https://github.com/dotcloud/express-on-dotcloud/blob/master/app/app.js#L65

    You setup a middle that send the session to all the routes’s template.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In an effort to lean Rx I'm writing a simple application which imitates reading
I am writing a simple WinForms application in which I allow the user to
I'm new to JavaFX and I'm writing a simple login application that I would
I'm writing a simple little application, which is a booking system. In the system
I am writing a very simple application which allows one to change the temperature.
I'm writing fairly simple application which connects to server through SSH (using paramiko ),
I'm writing a simple Android application that needs some text which should be written
I'm writing an application using gtkmm. I wrote a simple widget class, that I
I'm writing a simple application which will connect with a server. However I want
I writing a C++ simple application, to figure out why i can't display any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.