Put registration into LoginManager

Also added additional checks in the register method to prevent
re-registering an already taken username.