Search code examples
phplaravelauthenticationlaravel-5.3

Laravel - Master password / Log into other accounts?


I have developed a nutrition platform that I'm using with my clients. It's somewhat similar to MyFitnessPal.

Some of my clients need help refining their diets so I need to log into their account to make changes to their plan.

What's the best option to achieve this? I thought of maybe having a master password that lets me log into any clients account but I don't know how to implement this.

My postLogin() method in the LoginController doesn't seem to be doing anything.


Solution

  • In our applications we have a route/controller method in the admin backend that does something like auth()->login($user); then redirects you to the route the usual user would go to when they first login.

    Docs: https://laravel.com/docs/5.4/authentication#other-authentication-methods