Org Web Adapter

journals/2021_05_19.org

ID
99a6d152-f386-45d2-a7a1-2b174b0ab3d2

2021-05-19 - Wednesday

Work

DONE Triage SSO issue with Moderna

ATTACH

CLOSED:

ID
f5e93c97-9ff4-40f1-bbcd-ca3722468419

- Note taken on

Seems like there's a bug in the SSO flow with iOS where a user ends up in a

loop that swings around their invite status and the setting of

`has_not_completed_profile` setting on the user preferences block.

The kibana logs are showing the user (the CEO in this case) getting stuck in a

login loop with this log message, see attachment.

+ User is successfully going through: [[file:~/src/github.com/15five/fifteen5/ff/mods/account/views.py::def first_login_complete_profile(request):]]

+ Getting to the index view: [[file:~/src/github.com/15five/fifteen5/ff/mods/account/views.py::post_login_response = get_post_login_redirect_response(request, request.user)]]

+ And then to: [[file:~/src/github.com/15five/fifteen5/ff/mods/account/utils.py::def get_post_login_redirect_response(request, user):]]

That seems to be the scope of the loop.

#+begin_src python from get_post_login_redirect_response

if user.invite_status in InviteStatus.pending() or user.get_pref(

USER_PREF_FIRST_LOGIN_DONE_VIA_MOBILE, False

):

return HttpResponseRedirect(reverse('ff_first_login_complete_profile'))

#+end_src

#+begin_src python first_login_complete_profile

if not request.user.should_go_through_profile_completion:

messages.info(

request, 'Your profile is already active. There\'s no need to activate it again.'

)

return HttpResponseRedirect(reverse('ff_index'))

#+end_src

Turns out the bug is here: [[file:~/src/github.com/15five/fifteen5/ff/mods/mobile/utils.py::def on_first_login_mobile(user):]]

Specifically

#+begin_src python

def on_first_login_mobile(user):

if user.invite_status == InviteStatus.ACTIVE:

return

on_first_login(user, called_from='First login via mobile')

user.set_pref(USER_PREF_FIRST_LOGIN_DONE_VIA_MOBILE, True, save=True) # THIS FUCKS IT ALL UP

#+end_src

The preference there is poorly named and rather than saying "oh yeah, logged

in via mobile" the pref is "have not completed profile yet" I think the idea

is to allow mobile login while tracking that they haven't yet logged in via

the web app and completed their profile, but the result is a login loop.

For Moderna, to unblock them today, we need to run a script that sets that

pref for each user.

#+begin_src python

from ff.mods.account.constants import USER_PREF_FIRST_LOGIN_DONE_VIA_MOBILE

moderna_users = User.objects.filter(company_id=57997)

for moderna_user in moderna_users:

moderna_user.set_pref(USER_PREF_FIRST_LOGIN_DONE_VIA_MOBILE, False, save=True)

#+end_src

DONE [[id:83c7915c-56a1-4645-b983-dabfc1e89336][15Five Project: Engagement Integration with 15Five]] kick-off

CLOSED:

<2021-05-19 Wed 8:00-9:30>

DONE [[id:804198f9-98a8-4b09-b485-bb6d7db2e752][Stand-up meeting with Piotr]]

CLOSED:

<2021-05-19 Wed 9:30-10:00>

DONE [[id:555cdffd-34e7-4de1-a3f5-8ffc52ac58a8][Partnership Squad Estimation Session]]

CLOSED:

+ Primary goal is estimating tickets for [[id:c3e26ee3-ec0b-4554-a0b7-66bdbbfc27ad][15Five Project: Pricing Package Update]]

DONE [[id:f666f784-1570-4f63-aadc-54a5803179c0][Partnership Squad Huddle]]

CLOSED:

DONE [[id:b070e057-6cc2-43a8-992e-4f010b0bb709][Devops Pair Programming Session]]

CLOSED:

DONE Add period and term details to [[id:113620f5-ba25-4a54-bc8b-44b70d6cc712][ENG-16624]]

CLOSED:

Personal

DONE Water the garden

CLOSED:

Timeline

- Note taken on

Another day, another early morning! Emma woke me up around 6 and I was out of bed by 6:30. After that it was a morning full of meetings and one critical issue with Moderna where the CEO was unable to login to the iOS app.