Sometimes it's nice to redirect a user to the original requested route. So I added the requested route to the session before redirecting the unauthenticated user.
In the login controller, after successful login, it could be used like this:
let goto = try request.session()["goto"] ?? "/"
return request.redirect(to: goto)
Closing due to inactivity - I agree something should be done but I think as @tanner0101 says, it locks it to sessions and also the String isn't configurable.
Sometimes it's nice to redirect a user to the original requested route. So I added the requested route to the session before redirecting the unauthenticated user.
In the login controller, after successful login, it could be used like this: