def on_created(self, docs): """Send email to user with reset password token.""" super().on_created(docs) resetService = get_resource_service('reset_user_password') activate_ttl = app.config['ACTIVATE_ACCOUNT_TOKEN_TIME_TO_LIVE'] for doc in docs: if self.user_is_waiting_activation(doc): tokenDoc = {'user': doc['_id'], 'email': doc['email']} id = resetService.store_reset_password_token(tokenDoc, doc['email'], activate_ttl, doc['_id']) if not id: raise SuperdeskApiError.internalError('Failed to send account activation email.') tokenDoc.update({'username': doc['username']}) send_activate_account_email(tokenDoc, activate_ttl)
def on_created(self, docs): """Send email to user with reset password token.""" super().on_created(docs) resetService = get_resource_service('reset_user_password') activate_ttl = app.config['ACTIVATE_ACCOUNT_TOKEN_TIME_TO_LIVE'] for doc in docs: if self.user_is_waiting_activation(doc): tokenDoc = {'user': doc['_id'], 'email': doc['email']} id = resetService.store_reset_password_token(tokenDoc, doc['email'], activate_ttl, doc['_id']) if not id: raise SuperdeskApiError.internalError('Failed to send account activation email.') tokenDoc.update({'username': doc['username']}) send_activate_account_email(tokenDoc)
def on_created(self, docs): """Send email to user with reset password token.""" super().on_created(docs) resetService = get_resource_service("reset_user_password") activate_ttl = app.config["ACTIVATE_ACCOUNT_TOKEN_TIME_TO_LIVE"] for doc in docs: if self.user_is_waiting_activation(doc): tokenDoc = {"user": doc["_id"], "email": doc["email"]} id = resetService.store_reset_password_token( tokenDoc, doc["email"], activate_ttl, doc["_id"]) if not id: raise SuperdeskApiError.internalError( "Failed to send account activation email.") tokenDoc.update({"username": doc["username"]}) send_activate_account_email(tokenDoc, activate_ttl)