Refactor login redirect helper
Protect nit edit endpoint