vapor / auth

👤 Authentication and Authorization framework for Fluent.
53 stars 34 forks source link

Add original route to session before redirecting #48

Closed code28 closed 5 years ago

code28 commented 6 years ago

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)
0xTim commented 5 years ago

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.