Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Dynamic translation and Post view configuration changes #758

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

kantorii
Copy link
Contributor

This request includes the following changes:

Prevent translated messages from being cached, so that language can be changed dynamically.
Added configuration for SECURITY_POST_FORGOT_VIEW
(This specifies the page to transition to after sending instructions to reset password.)
Added configuration for POST_SEND_CONFIRMATION_VIEW
Added many translations for Japanese.
Renamed translation file for nl_NL, because it is likely wrong.

Please let me know if you want to remove some changes.
Of course, you are free to remove them yourself.

Added configuration for SECURITY_POST_FORGOT_VIEW
This specifies the page to transition to after sending instructions to reset password.
Added configuration for POST_SEND_CONFIRMATION_VIEW
Added many translations for Japanese.
Renamed translation file for nl_NL, because it is likely wrong.
@kantorii kantorii changed the title 20180221d pull request Translation and configuration changes Feb 24, 2018
@kantorii kantorii changed the title Translation and configuration changes Dynamic translation and Post view configuration changes Feb 24, 2018
@kantorii
Copy link
Contributor Author

kantorii commented Mar 12, 2018

Added another commit:

Don't flash message if there was an error sending welcome email.

if self.message and self.message.isupper():
self.message = get_message(self.message)[0]
self.message_key = self.message
self.message = get_message(self.message_key)[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the self.message_key is not set?

Can we change the Validator mixin to something around this lines?

class ValidatorMixin(object):
   
    @property
    def message(self):
        if self._templated:
            return get_message(self._message)[0]
        return self._message

    @message.setter
    def message(self, value):
        self._templated = value and value.isupper()
        self._message = value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why did I miss that? :)

I'm ok with properties.
Do you want me to put it into this Pull Request?

Copy link
Contributor

Choose a reason for hiding this comment

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

@kantorii yes, you can update this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jirikuncar Thanks for the wait. The suggested change is on the branch now.

Copy link
Contributor

@jirikuncar jirikuncar left a comment

Choose a reason for hiding this comment

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

Can you send a separate PR with the jp translations? Thanks

kantorii added a commit to kantorii/flask-security that referenced this pull request Jun 30, 2018
@@ -40,4 +39,7 @@ def register_user(**kwargs):
'welcome', user=user,
confirmation_link=confirmation_link)

if _security.confirmable:
Copy link
Contributor

Choose a reason for hiding this comment

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

@kantorii can you please clarify why do we need to move the do_flash call to the separate block?

Copy link
Contributor Author

@kantorii kantorii Jul 8, 2018

Choose a reason for hiding this comment

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

Yes. If there is an exception within user_registered.send(), do_flash() will not be executed.
I believe it should be that way, because, if I remember correctly, the flash says an email was sent.

@jirikuncar jirikuncar changed the base branch from develop to master October 10, 2018 19:38
@jirikuncar jirikuncar changed the base branch from master to develop October 10, 2018 19:38
Copy link
Contributor

@jirikuncar jirikuncar left a comment

Choose a reason for hiding this comment

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

@kantorii it looks good now. Can you rebase and remove the commit with translations?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants