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

Fix of the login form after Flask-Security and WTForms upgrade #224

Merged
merged 6 commits into from Apr 3, 2023

Conversation

quaxsze
Copy link
Contributor

@quaxsze quaxsze commented Mar 13, 2023

@quaxsze quaxsze requested a review from maudetes March 13, 2023 14:14
Copy link
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

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

Don't forget the changelog ;)

I think the security override init may not work anymore. captcha_code attribute is missing when trying to display http://dev.local:7000/fr/register

{{ f.label.text }}
</label>
</div>
{{ render_boolean_field(f) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you take this update from Flask Security forms?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no I made a func for it:

{% macro render_boolean_field(f) %}
<div class="fr-checkbox-group">
    {{ f() }}
    <label class="fr-label" for="{{ f.id }}">
        {{ f.label.text }}
    </label>
</div>
{% endmacro %}

I did this so i can reorganize the login form after the update

@quaxsze quaxsze requested a review from maudetes March 21, 2023 17:04
@maudetes
Copy link
Contributor

I think the security override init may not work anymore. captcha_code attribute is missing when trying to display http://dev.local:7000/fr/register

I still reproduce this issue.
The way forms are registered seem to have changed? Based on the flask security init_app logic, I found that changing the form override by the following seemed to work in my case:

            security.forms['register_form'].cls = ExtendedRegisterForm
            security.forms['confirm_register_form'].cls = ExtendedRegisterForm

Not sure why it seems to work in your case.

Copy link
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

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

Seems like we're clear! 👏
Don't forget the changelog!

@maudetes maudetes mentioned this pull request Apr 3, 2023
@quaxsze quaxsze merged commit 8f91435 into master Apr 3, 2023
7 checks passed
@quaxsze quaxsze deleted the GenericResponseSecurity branch April 3, 2023 10:58
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.

None yet

2 participants