-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ConnectID Invite/De-Link/Re-Link features #34967
base: master
Are you sure you want to change the base?
Changes from 1 commit
55c8233
6c180df
80a6157
1f3e480
cf7b51f
407303f
c7bd88e
def8ce9
f0b60a1
c0a2f49
5b496a5
b7d6dd8
7150aaf
3f285b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -811,7 +811,7 @@ def create_mobile_worker(self, in_data): | |
if self.new_mobile_worker_form.cleaned_data['account_invite_by_cid']: | ||
phone_number = self.new_mobile_worker_form.cleaned_data['phone_number'] | ||
couch_user.set_default_phone_number(phone_number) | ||
deliver_connectid_invite(couch_user) | ||
deliver_connectid_invite(couch_user, self.request) | ||
|
||
plan_limit, user_count = Subscription.get_plan_and_user_count_by_domain(self.domain) | ||
check_and_send_limit_email(self.domain, plan_limit, user_count, user_count - 1) | ||
|
@@ -1747,7 +1747,6 @@ def link_connectid_user(request, domain): | |
@require_can_edit_commcare_users | ||
@location_safe | ||
def send_connectid_invite(request, domain, user_id): | ||
# Currently same as what send_confirmation_sms does | ||
user = CommCareUser.get_by_user_id(user_id, domain) | ||
if user.domain != domain: | ||
return HttpResponse(status=400) | ||
|
@@ -1757,10 +1756,11 @@ def send_connectid_invite(request, domain, user_id): | |
return HttpResponse(status=200) | ||
|
||
|
||
def deliver_connectid_invite(user): | ||
def deliver_connectid_invite(user, request=None): | ||
# ConnectID server delivers the invite to user | ||
if user.is_account_confirmed or not user.is_commcare_user(): | ||
messages.error(request, "The user is already confirmed or is not a mobile user") | ||
if request: | ||
messages.error(request, "The user is already confirmed or is not a mobile user") | ||
return False | ||
|
||
invite_code = encrypt_account_confirmation_info(user) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo; I will need to coordinate with mobile to get a link that opens ConnectID app with the invite intent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One other alternative is to send this as push notification (probably via the connectid server). That way the app is already handling it, and we know they are logged in. It will also allow us to hide all the info that doesn't matter to the user (like the code or username, which they won't be familiar with), since we can pass that in the data params. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, definitely push notification would be better. I remember Dave mentioning this specifically needed an SMS deeplink (I don't recall why). I will check with him and see if we can do push notification (on top of SMS). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does encrypting the invite code do for us here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the code 'encodes' the invitation sent time, so that before confirming it can check the invite didn't expire. This is really a soft enforcement used in the other two multi-stage user provision workflows, so I took the pattern as it is. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not want these messages for the import results?