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

Add ability to customize message format in the #97

Open
vaughnkoch opened this issue Jan 30, 2024 · 2 comments
Open

Add ability to customize message format in the #97

vaughnkoch opened this issue Jan 30, 2024 · 2 comments

Comments

@vaughnkoch
Copy link

Hi, currently you can customize DPV by extending BaseBackend. Would it be possible to allow PhoneVerificationService to check whether the backend wants to supply the message directly, instead of having it only pull from settings.PHONE_VERIFICATION['MESSAGE']?

Specifically, allow the backend to replace this logic:

def _generate_message(self, security_code):
    return self.verification_message.format(
        app=settings.PHONE_VERIFICATION.get("APP_NAME", DEFAULT_APP_NAME),
        security_code=security_code,
    )
@CuriousLearner
Copy link
Owner

Hi @vaughnkoch

Can you please let me know about your exact use-case here? 🤔 I'm trying to understand what you are trying to accomplish.

@vaughnkoch
Copy link
Author

Hi, to be honest I don't recall the exact use case since this was 6 months ago. But in general, it would be useful to be able to customize the message since currently the only variables allowed are app and security_code, and the rest of the message has to be determined at import time, not runtime. So you can't say for example 'Hello, {user_name}, your code is {security_code}`.

This should be straightforward enough if the BaseBackend can call an optionally-defined function, or allow the message generation function to be overridden by a subclass.

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

No branches or pull requests

2 participants