15043

How can I detect a user's computer/browser session for auth purposes

Question:

I am trying to implement a login system that sends a confirmation email to the user in case he logs in from a new computer/browser.

I am using Nodejs, AngularJS and PassportJS.

Any pointers to where I could find resources for this will be greatly appreciated.

Answer1:

The client side can detect stuff like os/browser, so you can just POST that data up to the server whenever the client loads. Other than that, you can match usernames with IP-adresses, but if you're storing that kind of information you ought to hash the information before saving it.

Answer2:

Could be as simple as setting a session variable (<a href="https://github.com/expressjs/session" rel="nofollow">https://github.com/expressjs/session</a>)

if(req.user){ // so that it only triggers when the user has actually logged in if(!req.session.thisBrowser) { req.session.thisBrowser = true || 'this computer/browser' || 'whatever'; req.user.email('You have been logged in from ...'); // do your thing } }

Recommend

  • angular Scroll div on button click
  • Getting webGL error in autodesk viewer
  • How to re-render views using Angular JS
  • including Python.h in C++ file CDT
  • Extjs, handling success or failure when doing a standard submit in a form
  • How to change default stop edit behavior in jtable
  • Run EF6 Query in separate Thread on WinForm Button Click Event
  • What is the equivalent of Android permissions in iOS development? [duplicate]
  • Adding independent aspx/asmx pages into DotNetNuke
  • Merge Module leaving files during uninstall
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • xtable - background colour of added rows
  • Symfony2 - Doctrine - no changeset in post update
  • Using MouseListener to select a range of cells in a grid
  • Lock Horizontal View
  • Find group of records that match multiple values
  • How to specify input and output paths from cmd.exe for a PowerShell script?
  • Bash if statement with multiple conditions
  • Center align outputs in ipython notebook
  • JqueryMobile Popup menu is not working
  • Jquery popup on mouse over of calendar control
  • JBoss External Properties Files in Classpath
  • gspread or such: help me get cell coordinates (not value)
  • Alternative To body {overflow:scroll;} That Will Prevent Page Jostling/Wriggling?
  • How to define and use opencv mat of user type
  • Custom Tabgroup Appcelerator
  • Setting up SourceTree to merge unity3d scenes with UnityYAMLMerge
  • Record samples being played with OpenAL
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Projection media query: browser support and workarounds?
  • Different response to non-authenticated users and AJAX calls
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Can I make an Android app that runs a web view in Chrome 39?
  • Cannot Parse HTML Data Using Android / JSOUP
  • How do you join a server to an Active Directory (domain)?
  • Understanding cpu registers
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Is there any way to bind data to data.frame by some index?
  • How can i traverse a binary tree from right to left in java?