complete implementation of login and session v1