Create login automatism 

- [x] treat restoring connection as separated function
- [ ] resolve library dependencies