Smart redirect

Implement smart redirect to last viewed page after login or signup.