Commit Graph

4612 Commits

Author SHA1 Message Date
Frédéric Péters 83dc1af714 add initial migration (#13077) 2019-05-31 14:51:55 +02:00
Mikaël Ates 33db4a2c4a Update official about link. 2019-05-31 14:51:55 +02:00
Mikaël Ates 7888183694 Move registration frontend method to the Frontend (fixes #11351).
Needs authentic2 >= v2.1.20-1010.
2019-05-31 14:51:55 +02:00
Mikaël Ates 5262af3cb9 Hide linking button on profile frontend if the user is already linked (fixes #11328). 2019-05-31 14:51:55 +02:00
Mikaël Ates 7976894a6e Add email in linking message (fixes #10912). 2019-05-31 14:51:55 +02:00
Mikaël Ates da69491c5d Improve wording on unlinking page. 2019-05-31 14:51:55 +02:00
Mikaël Ates 7a8568009d Fix bad translation. 2019-05-31 14:51:55 +02:00
Mikaël Ates 1cad60d8b3 Prevent to add a link with an FC account already linked with another user (fixes #10791). 2019-05-31 14:51:55 +02:00
Mikaël Ates 032a39e023 Remove obsolete setting. 2019-05-31 14:51:55 +02:00
Mikaël Ates 9b9f5ae2f8 Hide unlinking link if the user has no password and can't set it (fixes #10775). 2019-05-31 14:51:55 +02:00
Mikaël Ates 6b45d6c9b2 Prevent unlinking if the user has no password and can't set it (fixes #10775).
Unlinking is now prevented if the user has no usable password and can't
    change it because A2_REGISTRATION_CAN_CHANGE_PASSWORD is False.
    For now it is thus assumed that the password is the unique other mean of
    authentication and unlinking would make the account unreachable.

    Also use A2_REGISTRATION_SET_PASSWORD_FORM_CLASS setting instead of
    importing the form.
2019-05-31 14:51:55 +02:00
Mikaël Ates 0fb6d457f4 Update login or create account message. 2019-05-31 14:51:55 +02:00
Mikaël Ates 44a62e61df Ask password at unlinking when the user has no usable password (fixes #10524) (ter). 2019-05-31 14:51:55 +02:00
Mikaël Ates 86f20deded Ask password at unlinking when the user has no usable password (fixes #10524) (bis). 2019-05-31 14:51:55 +02:00
Mikaël Ates eb2ea06aef Ask password at unlinking when the user has no usable password (fixes #10524). 2019-05-31 14:51:55 +02:00
Mikaël Ates e80db2691c Define a registration frontend and manage account creation with FC data (fixes #10621).
The registration frontend is used when the user is not logged locally
    not with FC. The login template provide a link to the FC login view and
    then to the plugin registration view.

    If the user is already logged with FC, the login template provide a link
    to the plugin registration view.
2019-05-31 14:51:55 +02:00
Mikaël Ates 32e71fcff5 Add a registration view (fixes #10621).
The view is called to create an account using the data provided by FC
    at account creation.

    The data provided is put in a protected token and sent to the next url.

    If FC provides an email, the view redirects to the activation view.

    If an email is not provided, the view redirects to the email registration
    view.

    The confirm_data parameter of the activation view is a plugin setting.

    Account creation with FC means no password.
2019-05-31 14:51:55 +02:00
Mikaël Ates ba11f6b8cb Display on the login page a button for quick account creation (fixes #10510).
After a successful sso and no user is authenticated the user is redirected
    on the login page. On the login page, the user may be asked to login with a
    password or to create a new account. The plugin login button is hidden to avoid
    an unecessary loop.

    The patch add an option to display an other button that the login button.
    This button reference the registration page and is filled with data from
    the sso. If skip resgitration with prefilling data options are set on authentic
    the button leads to a direct account creation.
2019-05-31 14:51:55 +02:00
Mikaël Ates 56fb0f012e Add new scopes at login (fixes #10510). 2019-05-31 14:51:55 +02:00
Mikaël Ates 315f064f5e Remove deprecated idp info form the unicode of an FCAccount (fixes #10628). 2019-05-31 14:51:55 +02:00
Mikaël Ates 6d2c463453 New image for the linking button and style refined. 2019-05-31 14:51:55 +02:00
Mikaël Ates 6352672798 New images for the login button and style refined. 2019-05-31 14:51:55 +02:00
Mikaël Ates 5ee5db17a5 Remove title from profile frontend. 2019-05-31 14:51:55 +02:00
Mikaël Ates f4fceb96b5 Inactive users can not authenticate (fixes #10312). 2019-05-31 14:51:55 +02:00
Mikaël Ates 15ca4ed2af Return URL at logout from unlink is not a named url anymore. 2019-05-31 14:51:55 +02:00
Mikaël Ates 1c4a33976e Set an explicit return URL at logout from unlink in app settings. 2019-05-31 14:51:55 +02:00
Mikaël Ates b7012a127f Redirection ending logout return un url, not named url. 2019-05-31 14:51:55 +02:00
Mikaël Ates 5f1c7b36a7 Add some debug logs. 2019-05-31 14:51:55 +02:00
Mikaël Ates d28fd50bbb Change default value of settings CREATE and LOGOUT_WHEN_UNLINK 2019-05-31 14:51:55 +02:00
Mikaël Ates 8d2fbe1c2e Implement prefilling of registration form (fixes #10267). 2019-05-31 14:51:55 +02:00
Mikaël Ates 968981fff3 Really clean session at logout. 2019-05-31 14:51:55 +02:00
Mikaël Ates 3abb7e4eae Update message at account linking. 2019-05-31 14:51:55 +02:00
Frédéric Péters 0b931da020 translation: fix a typo 2019-05-31 14:51:55 +02:00
Mikaël Ates 2b8a0b2620 Refine data provider management.
Data is requested using the login or link endpoint view giving
    space delimited scopes in the `fd_scopes` get parameter.

    Data is stored in a dictionnary of scopes in the session.

    Build FD request url using urlencode.

    Use urlencode from django rather than from urllib.
2019-05-31 14:51:55 +02:00
Mikaël Ates f4ddbd363e Handle ressource resolution failure and fail sso in that case. 2019-05-31 14:51:55 +02:00
Mikaël Ates 51f7ad8dd7 Handle errors in access token call as for ressource resolution. 2019-05-31 14:51:55 +02:00
Mikaël Ates c9d8f87d4a Use a single logger declaration. 2019-05-31 14:51:55 +02:00
Mikaël Ates f1613946d2 Enhance messages and update translations. 2019-05-31 14:51:55 +02:00
Mikaël Ates 703ca6b5b3 Use the official images and about link (fixes #9718).
Use the official images for the log in button and the linking
    button in profile.

    Add about page link on frontends.

    Add title for the profile frontend.

    Add translation statements.
2019-05-31 14:51:55 +02:00
Mikaël Ates 4f1843a3c5 Add a setting for about page url set in the frontend contexts.
Display a link on FranceConnect about page is mandatory.

    The url in different in testing, the default one, from the
    production mode.
2019-05-31 14:51:55 +02:00
Mikaël Ates 584d922704 Add missing logger declaration (from 89f3efd15f). 2019-05-31 14:51:55 +02:00
Mikaël Ates a86f61c9b9 Refactor logout at unlinking.
Use new setting to enable logout at unlinking. Some cases need it,
    like FranceConnect, but others may not. Disabled by default, enable
    with : A2_FC_LOGOUT_WHEN_UNLINK = True.

    Use new setting for the return url after logout at unlinking. It is
    for now 'account_management' but it could be modified. By default it
    is the same as the return url at normal logout. Then it should be set
    with A2_FC_LOGOUT_AT_UNLINK_RETURN_URL = 'account_management'.

    Use logout url building function in utils.
2019-05-31 14:51:55 +02:00
Mikaël Ates 84d1b3d722 Add a setting to enable unlinking when account creation is activated. 2019-05-31 14:51:55 +02:00
Mikaël Ates 9d19fb54c4 Handle token response connexion errors. 2019-05-31 14:51:55 +02:00
Mikaël Ates e484153e46 Do not create a new user if the user is already authenticated. 2019-05-31 14:51:55 +02:00
Mikaël Ates 7be7f991d3 Handle token response errors. 2019-05-31 14:51:55 +02:00
Mikaël Ates 06a9951c3b Add log at user creation. 2019-05-31 14:51:55 +02:00
Mikaël Ates b00491293a Move logout url building to a utils file. 2019-05-31 14:51:55 +02:00
Mikaël Ates 170d365dda POST data for the token request is not in json.
As specified in the RFC4769 'The client makes a request to the token
    endpoint by sending the following parameters using the
    "application/x-www-form-urlencoded"'.
2019-05-31 14:51:55 +02:00
Mikaël Ates e421f60c80 Plugin method for logout by redirection and no more logout in an iframe
A separate Plugin method is now used to return logout profiles
    by redirection.

    The logout by iframe is removed because it is not officially supported.

    Some useless app settings have been remove.

    The next field name can now be set in app settings.
2019-05-31 14:51:55 +02:00