FedericoCeratto/bottle-cork

Avoid hardcoding hostname in template used by send_password_reset_email

Closed this issue · 5 comments

Is there a way to avoid hardcoding the host part of the URL in the email_template used by send_password_reset_email?

Are you referring to this file? https://github.com/FedericoCeratto/bottle-cork/blob/master/examples/views/password_reset_email.tpl
If so, you can simply edit the URL in it, or do you want the URL to be set dynamically?

Hi,

On Thu, Oct 23, 2014 at 1:27 PM, Federico Ceratto
notifications@github.com wrote:

Are you referring to this file? https://github.com/FedericoCeratto/bottle-cork/blob/master/examples/views/password_reset_email.tpl

Not really it's the routine in cork.py

def send_password_reset_email(self, username=None, email_addr=None,
    subject="Password reset confirmation",
    email_template='views/password_reset_email'):

...
that uses the template
# send reset email
email_text = bottle.template(email_template,
username=username,
email_addr=email_addr,
reset_code=reset_code
)

If so, you can simply edit the URL in it, or do you want the URL to be set dynamically?

Yes I want to be able to set the URL dynamically since the system I'm
developing is used on several diffrent machines with different URLs.
And I don't really want to resort to have diffrent templates on
diffrent machines.

Cheers

Anders

Anders Ardö

Ok, suppose we add a "hostname" varible to the email template, how could the developer set its value? Would it be ok to configure it at setup time, when the Cork() class is instantiated?

That would be perfectly OK.

On Sun, Oct 26, 2014 at 9:31 PM, Federico Ceratto notifications@github.com
wrote:

Ok, suppose we add a "hostname" varible to the email template, how could
the developer set its value? Would it be ok to configure it at setup time,
when the Cork() class is instantiated?


Reply to this email directly or view it on GitHub
#76 (comment)
.

Hilsen

Anders

Anders Ardö

Closed by #88