stable

Clone or download

Read-only

feat: Add token in registration link in invitation email

When a user invites someone to register on Tuleap, the latter should not have to fill it's email, and will not receive a confirmation link by email. Furthermore, when there is no need for user approval by site admin (`sys_user_approval = 0`) then the user is automagically logged in and redirected to its dashboard. A success feedback is currently displayed but it will be replaced by modal in a dedicated contribution. User approval is left unchanged if `sys_user_approval = 1`. This means that site admin can be tempted to ask to the invited user to confirm its email with [Validate] button on Pending users page (And [Resend email] button on Users pending email activation). A dedicate contribution will deal with this if needed. If token is invalid, then request is rejected. Note: this change of behavior is only valid for new invitations. Old invitations still works, but invitees will have to confirm their email. Suggested starting points for the review: * token is generated in src/common/InviteBuddy/InvitationSender.php * token is then used to retrieve the invitation in src/common/User/Account/Register/InvitationToEmailRequestExtractor.php * so that email is forced in src/common/User/Account/Register/RegisterFormPresenterBuilder.php and in src/common/User/Account/Register/RegisterFormHandler.php Part of request #29614: Invited users shouldn't be mandated to re-confirm their email Change-Id: Ic270cebc45921a87e0090c4ceea6268a51ab5a95

Modified Files

Name
M site-content/fr_FR/LC_MESSAGES/tuleap-core.po +7 −0 Go to diff View file
M site-content/pt_BR/LC_MESSAGES/tuleap-core.po +7 −0 Go to diff View file
A src/common/InviteBuddy/InvalidInvitationTokenException.php +27 −0 Go to diff View file
A src/common/InviteBuddy/Invitation.php +34 −0 Go to diff View file
A src/common/InviteBuddy/InvitationByTokenRetriever.php +33 −0 Go to diff View file
M src/common/InviteBuddy/InvitationDao.php +32 −4 Go to diff View file
M src/common/InviteBuddy/InvitationEmailNotifier.php +5 −3 Go to diff View file
M src/common/InviteBuddy/InvitationSender.php +32 −49 Go to diff View file
M src/common/InviteBuddy/InviteBuddiesPresenter.php +2 −1 Go to diff View file
A src/common/InviteBuddy/PrefixTokenInvitation.php +36 −0 Go to diff View file
M src/common/InviteBuddy/REST/v1/InvitationsResource.php +6 −2 Go to diff View file
M src/common/Request/RouteCollector.php +16 −1 Go to diff View file
M src/common/User/Account/Register/AccountRegister.php +4 −2 Go to diff View file
M src/common/User/Account/Register/AfterSuccessfulUserRegistration.php +11 −0 Go to diff View file
A src/common/User/Account/Register/DisabledField.php +36 −0 Go to diff View file
M src/common/User/Account/Register/DisplayRegisterFormController.php +9 −1 Go to diff View file
A src/common/User/Account/Register/IExtractInvitationToEmail.php +29 −0 Go to diff View file
A src/common/User/Account/Register/InvitationShouldBeToEmailException.php +27 −0 Go to diff View file
A src/common/User/Account/Register/InvitationToEmail.php +48 −0 Go to diff View file
A src/common/User/Account/Register/InvitationToEmailRequestExtractor.php +58 −0 Go to diff View file
M src/common/User/Account/Register/ProcessRegisterFormController.php +9 −1 Go to diff View file
R src/common/account/Account_RegisterField.class.php Go to diff View file
M src/common/User/Account/Register/RegisterFormContext.php +4 −4 Go to diff View file
M src/common/User/Account/Register/RegisterFormHandler.php +21 −9 Go to diff View file
M src/common/User/Account/Register/RegisterFormPresenterBuilder.php +25 −17 Go to diff View file
A src/common/User/Account/Register/RegisterPrefillValuesPresenter.class.php +35 −0 Go to diff View file
A src/common/User/LogUser.php +34 −0 Go to diff View file
M src/common/User/UserManager.class.php +4 −13 Go to diff View file
M src/common/account/RegisterAdminPrefillValuesPresenter.class.php +2 −2 Go to diff View file
M src/common/account/RegisterByUserPresenter.class.php +1 −1 Go to diff View file
D src/common/account/RegisterPrefillValuesPresenter.class.php +0 −54 Go to diff View file
M src/common/account/RegisterPresenter.class.php +1 −1 Go to diff View file
M src/db/mysql/database_structure.sql +1 −0 Go to diff View file
A src/db/mysql/updates/2023/202301131649_add_verifier_in_invitations_table.php +35 −0 Go to diff View file
M src/templates/account/register-user.mustache +6 −1 Go to diff View file
M src/www/admin/usergroup.php +2 −1 Go to diff View file
A tests/integrations/tests/InviteBuddy/InvitationDaoTest.php +66 −0 Go to diff View file
A tests/unit/common/InviteBuddy/InvitationByTokenRetrieverStub.php +51 −0 Go to diff View file
M tests/unit/common/InviteBuddy/InvitationSenderTest.php +59 −23 Go to diff View file
M tests/unit/common/User/Account/Register/AfterSuccessfulUserRegistrationTest.php +53 −3 Go to diff View file
M tests/unit/common/User/Account/Register/DisplayRegisterFormControllerTest.php +5 −0 Go to diff View file
A tests/unit/common/User/Account/Register/IExtractInvitationToEmailStub.php +49 −0 Go to diff View file
A tests/unit/common/User/Account/Register/InvitationToEmailRequestExtractorTest.php +124 −0 Go to diff View file
A tests/unit/common/User/Account/Register/InvitationToEmailTest.php +45 −0 Go to diff View file
M tests/unit/common/User/Account/Register/ProcessRegisterFormControllerTest.php +5 −0 Go to diff View file
M tests/unit/common/User/ICreateAccountStub.php +7 −0 Go to diff View file
A tests/unit/common/User/LogUserStub.php +55 −0 Go to diff View file