write user credentials to the db