backport #1357 to stable45

backport of the alternative login feature

@karlitschek @MTRichards THX