Core: Improve the way the login dialog is managed

Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
Tests: first test try

Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>