Laravel 5.1 Middleware to check the creation date from a user to change password
I'm developing a webapp with Laravel 5.1 and I'm building the authentication system and I have to check if the user has not changed his password in six months or more and I would use a middleware to check this but I didn't find how I can do it properly. I created a global middleware but it is not working because I can't get the authenticated user.
It is possible that I have to use an AfterMiddleware to check the password?
I assume the global middleware idea fails when the user hits a route before they sign in, like the login page. Wouldn't it be best just to put the middleware on the __contruct() method of the controllers which you want to trigger the middleware? Takes a little longer than just one global middleware, but lets you avoid routes which are publicly accessible by users that aren't signed in.
@pmall Mmm, it is a good idea but the problem is that if the lifetime of the password is superior I don't have to let the user login until he change his password.