Fix 2fa redirects to onboarding
What does this MR do and why?
- Fix 2fa redirects to onboarding
- if a user does not finish onboarding and then is associated with a group that has 2fa enabled, they should be able to finish 2fa and not be redirected to onboarding.
- Finish onboarding if a user has finished the first welcome step, but not the rest and was added to a group or project(mirrors invite flow).
- Why is this related to the 2fa problem? In #424364 (closed) the case the customer has occurred when 2fa is enforced on the group level, which means the user would be a member as well. The 2fa problem in general needs the redirects fixed as there are other possibilities for 2fa being enforced besides at the group level, but this change will address them all.
- Reasoning on ordering and solution can be read up more in #424364 (comment 1546142055) and the issue description itself
Screenshots or screen recordings
screen | Before add to group | After add to group/refresh | Next screen |
---|---|---|---|
welcome step | |||
company step |
How to set up and validate locally
Prerequisites
- Setup to simulate SaaS and restart GDK
- Enable
check_namespace_plan
inrails console
ApplicationSetting.first.update(check_namespace_plan: true)
- Create a group and enforce 2fa setting for the group
- After a few minutes, your current account will force you to setup 2fa.
- Observe and finish the 2fa verification steps.
- Fill in password with password
- Get pin from
rails console
by finding the user record and then usinguser.current_otp
. - Click copy codes and click proceed on next page.
Finish onboarding when user hasn't completed welcome step
- Register as a new user and stop at the welcome screen after registration.
- As the owner of the created group, add the new user by username.
- As the new user, refresh the page.
- Observe you are now back on the welcome page w/only 2 dropdowns and a submit button.
- Answer and submit that form.
- Observe and finish the 2fa verification steps.
- Fill in password with password
- Get pin from
rails console
by finding the user record and then usinguser.current_otp
. - Click copy codes and click proceed on next page.
- Afterwards you will be on the profile account page.
- Compare to master behavior. This should be relatively the same behavior as master to the user, except the before actions for 2fa and welcome will not attempt to redirect each over each other(seen in network tab).
Finish onboarding when user is past welcome step
- Register as a new user.
- Fill in welcome screen with 'for company' selection and submit.
- Stop on the next form.(company form)
- As the owner of the created group, add the new user by username.
- As the new user, refresh the page.
- Observe and finish the 2fa verification steps.
- Fill in password with password
- Get pin from
rails console
by finding the user record and then usinguser.current_otp
. - Click copy codes and click proceed on next page.
- Afterwards you will be on the profile account page.
- Compare to master branch behavior. This is the case where there will be endless redirects between 2fa and company form.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #424364 (closed)
Edited by Doug Stull