Fix login redirect loop, update Devise

A redirect loop has happened always if user first tries to login with
invalid credentials, and then with correct ones - the return_to would
then point to the sign_in page and cause a loop.