|
@@ -127,7 +127,8 @@ class UserCommand(AppContextCommand):
|
127
|
127
|
"You must provide -p/--password parameter"
|
128
|
128
|
)
|
129
|
129
|
password = ''
|
130
|
|
-
|
|
130
|
+ if self._user_api.check_email_already_in_db(login):
|
|
131
|
+ raise UserAlreadyExistError()
|
131
|
132
|
try:
|
132
|
133
|
user = self._user_api.create_user(
|
133
|
134
|
email=login,
|
|
@@ -140,12 +141,12 @@ class UserCommand(AppContextCommand):
|
140
|
141
|
# daemons = DaemonsManager()
|
141
|
142
|
# daemons.run('radicale', RadicaleDaemon)
|
142
|
143
|
self._user_api.execute_created_user_actions(user)
|
143
|
|
- except IntegrityError:
|
|
144
|
+ except IntegrityError as exception:
|
144
|
145
|
self._session.rollback()
|
145
|
|
- raise UserAlreadyExistError()
|
|
146
|
+ raise UserAlreadyExistError() from exception
|
146
|
147
|
except NotificationNotSend as exception:
|
147
|
148
|
self._session.rollback()
|
148
|
|
- raise exception
|
|
149
|
+ raise exception from exception
|
149
|
150
|
|
150
|
151
|
return user
|
151
|
152
|
|