rt/d3| #813 | Small refactoring arround login, logout