User authentication and registering user working with db