login: handle 401 error

* Adds template and special handling of 401 error.

Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>
login: fix PEP8/257 errors

Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>