Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] survey: add link to create account in access error page #99299

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Odoonan
Copy link
Contributor

@Odoonan Odoonan commented Aug 31, 2022

When there is an authorization issue, the user sees a message inviting
him to log in, for surveys where it is required to be logged in.

According to the situation, the public user could also be invited to
create an account, if the option is available. Therefore, we go from
"Please Log in" to "Please Log in or Create an account" or just
"Please create an account" when the user should be connected but is not,
(depending on whether the current partner has users, on whether there is
already an user_input, for instance in the cookies, ...)

The template and controller method are updated accordingly.

Task-2925443

@robodoo
Copy link
Contributor

robodoo commented Aug 31, 2022

Pull request status dashboard

@C3POdoo C3POdoo requested a review from a team August 31, 2022 10:20
@Odoonan Odoonan force-pushed the master-survey-portal_registration_flow-nan branch from a9770b0 to e90e797 Compare August 31, 2022 10:55
@C3POdoo C3POdoo added the RD research & development, internal work label Aug 31, 2022
@Odoonan Odoonan force-pushed the master-survey-portal_registration_flow-nan branch 4 times, most recently from 397f08e to a01dd33 Compare September 5, 2022 09:34
Comment on lines +54 to +62
<t t-if="signup_url and login_url">
Please <a t-att-href="login_url">Log in</a> or <a t-att-href="signup_url">Create an account</a>.
</t>
<t t-elif="login_url">
Please <a t-att-href="login_url">Log in</a>.
</t>
<t t-elif="signup_url">
Please <a t-att-href="signup_url">Create an account</a>.
</t>
Copy link
Contributor

Choose a reason for hiding this comment

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

we could reduce a bit by doing this

<t t-if="signup_url or login_url">
    Please 
    <a t-if="login_url" t-att-href="login_url">Log in</a>
    <span t-if="login_url and signup_url">or</span>
    <a t-if="signup_url" t-att-href="signup_url">Create an account</a>
</t>
<t-else...

Comment on lines +222 to +227
""" If an answer_token exists and no partner is linked, and login in is now required, associate the existing answer to the
newly connected / created partner when going back to the survey, by the intermediate of this route. Redirects to the survey
start route afterwards. This prevents losing the current answer, and that answer to pollute the survey answers."""
Copy link
Contributor

Choose a reason for hiding this comment

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

This would need some unit tests

@Odoonan Odoonan force-pushed the master-survey-portal_registration_flow-nan branch from a01dd33 to cf66a64 Compare September 29, 2022 14:48
When there is an authorization issue, the user sees a message inviting
him to log in, for surveys where it is required to be logged in.

According to the situation, the public user could also be invited to
create an account, if the option is available. Therefore, we go from
"Please Log in" to "Please Log in or Create an account" or just
"Please create an account" when the user should be connected but is not,
(depending on whether the current partner has users, on whether there is
already an user_input, for instance in the cookies, ...)

If a direct invitation to a partner is clicked and the login is required,
then if that partner has no linked user, and no free sign up is allowed
in the general settings, they will not be abled to access the survey.
Therefore, display "Please contact an administrator to create an account"
instead.

The case of an public user having started the survey but the login going
from non required to required is also dealt with. This is done to avoid
having leftover user_inputs that are lost and unusable. A new route
called 'link_partner' is used to link the started answer to the partner
created OR logged in after being redirected from the error page.
On signing up / logging in, the user will be redirected to the survey
they were taking before. They can continue their answer and it is linked
correctly in the back end.

The method handling errors is also used when using the /print route. This
means that we could have a different partner_id between logged user and
the one who took the survey. To avoid any issue, we only ask the user to
log in in that case (no prepared login).

The template and controller method are updated accordingly.

Task-2925443
@Odoonan Odoonan force-pushed the master-survey-portal_registration_flow-nan branch from cf66a64 to 670e50c Compare September 30, 2022 08:29
@C3POdoo
Copy link
Contributor

C3POdoo commented Apr 16, 2024

Dear @Odoonan,

Thank you for your contribution but we are closing it due to inactivity.
We only support the last 3 stable versions so no longer accepts patches into this branch.

We apology if we could not look at your request in time.
If the contribution still makes sense, please let us know and do not hesitate to recreate one for the recent versions. We will try to check it as soon as possible.

This is an automated message.

@C3POdoo C3POdoo closed this Apr 16, 2024
@tde-banana-odoo
Copy link
Contributor

Task on pause, not canceled

@C3POdoo C3POdoo requested a review from a team April 16, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants