Skip to content

Conversation

@maudetes
Copy link
Contributor

@maudetes maudetes commented Jan 15, 2026

Requires opendatateam/udata#3620.

Adds hook to check if 2FA is required at login time.
Adds tf-setup and tf-validate pages to set up and validate 2FA.

TODO

  • add tests
    • improve so that they work on retry
  • add modale to setup 2FA admin profile page
  • add redirect for security views if not relevant (ex: user already logged in)

return false
}
finally {
loading.value = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should reset the qrcode here? To be sure it is used once and refresh if the modal is open again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to reset qrcode on invalid code for example? Don't you think we should reset only on success? The totp isn't valid until then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep on success, or maybe juts on modal open?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is currently reset on success, I'm not sure what you would like here

maudetes added a commit to opendatateam/udata that referenced this pull request Jan 29, 2026
Add minimal 2FA implementation.

The 2FA flow is self sufficient in udata but see also [cdata integration
counterpart](datagouv/cdata#875).

The settings that should be overridden if setting up 2FA:
```
SECURITY_TWO_FACTOR
SECURITY_TOTP_SECRETS
SECURITY_TOTP_ISSUER
SECURITY_TWO_FACTOR_RESCUE_MAIL
```
})
})

test.afterAll(async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of running udata commands in test cleanup @ThibaudDauce?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't mind :-) Could be nice to see it working if we want to do more complicated stuff like resetting the database (udata side I think) in the future

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it work by using udata working dir conf, we needed udata.cfg override in CI.

@maudetes maudetes marked this pull request as ready for review January 29, 2026 15:48
@maudetes maudetes merged commit aecb67c into main Jan 30, 2026
9 of 11 checks passed
@maudetes maudetes deleted the feat/add-2fa branch January 30, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants