fix pep8 issues
finish logging
Merge pull request #1 from alonbl/log

Log
minor fixes

* add checking if user from domain already exists
* check if legacy domain even exists
* fixed domain in db, it's authz not profile
* fixed commiting of db, was inverted
* profile was not written only logged