If you using js for your backend, try FirebaseauthUI, its the by far the best pre-made authentication system.
Advantages:
1. Completely open source (backend code available on github)
2. no worries on security sides, firebase is excellent for user system
Firebase provides a ton of services regarding authentication, check them out