Login API and auto registration logic.

Implementation of login API and automatic registration of netplanning
users.