All Projects → tprzytula → Meteor-Remember-Me

tprzytula / Meteor-Remember-Me

Licence: MIT License
Meteor accounts extension with remember me functionality

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Meteor-Remember-Me

SpringSecurityInEasySteps
Learn Spring Security step by step
Stars: ✭ 13 (+0%)
Mutual labels:  login, remember-me
yoti-java-sdk
The Java SDK for interacting with the Yoti Platform
Stars: ✭ 13 (+0%)
Mutual labels:  login
meteor-server-autorun
Server-side Tracker.autorun
Stars: ✭ 36 (+176.92%)
Mutual labels:  meteor
meteor-stat
Get a simple analysis of your Meteor app
Stars: ✭ 22 (+69.23%)
Mutual labels:  meteor
meteor-bootstrap-tagsinput
Bootstrap Tags Input packaged for Meteor Platform
Stars: ✭ 12 (-7.69%)
Mutual labels:  meteor
Pepaverse
Pepaverse is an open source social network build with nodejs, mongoDB, passportjs and socket.io
Stars: ✭ 16 (+23.08%)
Mutual labels:  login
meteor-apollo2
An example showing how to use Apollo 2.0 with GraphQL server + subscriptions
Stars: ✭ 20 (+53.85%)
Mutual labels:  meteor
meteor-google-spreadsheets
Google Spreadsheets for Meteor
Stars: ✭ 53 (+307.69%)
Mutual labels:  meteor
svelte-meteor-data
Reactively track Meteor data inside Svelte components
Stars: ✭ 14 (+7.69%)
Mutual labels:  meteor
SchoolRegistrationUI-Android
Check out the new style for App Design aims for school or colleges...😉😀😁😎
Stars: ✭ 56 (+330.77%)
Mutual labels:  login
react-apple-signin-auth
 Apple signin for React using the official Apple JS SDK
Stars: ✭ 58 (+346.15%)
Mutual labels:  login
pwa-meteor
meteor based pwa
Stars: ✭ 14 (+7.69%)
Mutual labels:  meteor
meteor-postcss
PostCSS for Meteor
Stars: ✭ 68 (+423.08%)
Mutual labels:  meteor
latelier
L'atelier, a project management tool
Stars: ✭ 74 (+469.23%)
Mutual labels:  meteor
grav-plugin-login
Grav Login Plugin
Stars: ✭ 40 (+207.69%)
Mutual labels:  login
fragments
Organise your bookmarks into boards
Stars: ✭ 56 (+330.77%)
Mutual labels:  meteor
Meteor-logger
🧾 Meteor isomorphic logger. Store application logs in File (FS), MongoDB, or print in Console
Stars: ✭ 51 (+292.31%)
Mutual labels:  meteor
meteor-flow-router-map
Meteor package for Flow Router
Stars: ✭ 15 (+15.38%)
Mutual labels:  meteor
spring-boot-mongodb-security-angular8
Spring Boot, Security, MongoDB, Angular 8: Build Authentication
Stars: ✭ 17 (+30.77%)
Mutual labels:  login
Dermatron
Dermatology focused medical records software, augmented with computer vision and artificial intelligence [Meteor packaged with Electron]
Stars: ✭ 19 (+46.15%)
Mutual labels:  meteor

Meteor - Remember Me

Coverage Status

RememberMe is a Meteor package that extends the default Accounts system with a new "remember me" functionality.

Login sessions by default have the expiry date set to 90 days which mean that once you've logged in into your application you are able to come back to it at any given point of time during this period and be still automatically logged in. You must have to log out yourself if you do not want that to happen.

However, this is not always what we intend to see as the users of any given application. Sometimes for privacy reasons we want to be sure that once we closed the website no one else would be able to control our account by visiting the website again from the same device without the need to always make sure to log out ourselves.

The following package gives the ability to control the default behaviour by giving users the power to make the decision if they want to persist their login sessions after they close the application or not.

All of this comes just as an additional parameter to the loginWithPassword method where you can simply provide true to keep the default behaviour or false if you want Meteor to reject the next auto-login attempt after you leave the website.

Installation

meteor add tprzytula:remember-me

You can view the package on atmosphere: https://atmospherejs.com/tprzytula/remember-me

Usage

  1. Import the package on the client side:
import RememberMe from 'meteor/tprzytula:remember-me';
  1. Replace your login method with this:
RememberMe.loginWithPassword(user, password, (error) => {
    // Your previous logic
}, false)

If you don't need a callback then you can simply change it to:

RememberMe.loginWithPassword(user, password, false)

API

All methods are client side only

loginWithPassword(string | Object: user, string: password, func: callback, boolean: rememberMe = true)

Wrapper for a Meteor.loginWithPassword with an addition of rememberMe as the last parameter.

If not provided, the default for rememberMe is true to match the behaviour of Meteor.

Refer to the Meteor's documentation for more information about the login method itself.

changeAccountsSystem(AccountsClient: customAccounts)

Gives the possibility to set a custom accounts instance to be used for the login system (more details)

Important notice

Many people were trying to solve this problem in the past by storing the setting in local storage and singing out the user or clearing their cached token when they come back. However, this approach might cause many side effects, especially when your business logic uses onLogin callbacks because the user will still be logged-in for a split of a second before their logic could take effect.

You won't be having these problems when using this package.

By using this dependency you can be sure that:

  • Not a single onLogin callback will be invoked when your users are coming back to the website after logging-in with rememberMe being false.
  • The rememberMe setting is stored only in the MongoDB when you leave the website. There will be no information regarding this setting stored in local storage, IndexedDB etc.
  • The rememberMe setting is unique not only to the user but also to the login token itself which means that each device will be respected separately. Logging-in on user "test" with rememberMe on your phone and then without rememberMe on your desktop won't stop you from being logged-in automatically the next time you visit the website on your phone.
  • Despite the choice you won't be suddenly logged-out when you reconnect after losing connection during the same session.

Testing

You can test this dependency by running npm run test:headless to perform unit tests or npm run test:e2e for Cypress tests instead. You can also check the results of a GitHub Action pipeline from the last commit.

As you might notice I'm using meteor test instead of meteor test-packages.

You can find more about why was I forced to create such a hack here. Hopefully this will be helpful for you if you ran through similar issues.

Changelog

Meteor Remember-Me - Changelog

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].