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

HTTPS scheme in email links #172

Open
ncrocfer opened this issue Jul 3, 2017 · 2 comments
Open

HTTPS scheme in email links #172

ncrocfer opened this issue Jul 3, 2017 · 2 comments

Comments

@ncrocfer
Copy link

ncrocfer commented Jul 3, 2017

Hello,

Do you know a simple way to force all links generated in emails from http:// to https:// please ?

For example when I receive the "Forgot password" email, the link is take from the reset_password_link variable.

This variable is generated in the send_reset_password_email() function, but the the _scheme argument is not customizable.

Did I miss something or this feature does not exists yet please ?

@carrete
Copy link

carrete commented Aug 2, 2017

From https://gitlab.com/tvaughan/docker-flask-starterkit/blob/master/flask-app/starterkit/app.py

from functools import partial

def _wrap_uwsgi_app(wsgi_app, environ, start_response):
    environ['wsgi.url_scheme'] = 'https'
    return wsgi_app(environ, start_response)

app.wsgi_app = partial(_wrap_uwsgi_app, app.wsgi_app)

@lingthio
Copy link
Owner

lingthio commented Aug 25, 2017

Hmmm. {{ reset_password_link }} is generated with flask.url_for(..., _external=True), which uses the scheme of the current request. So if the page that generates the link is using https (e.g. https://user/forgot-password), then the reset_password_link should start with https://.

Are you using https:// throughout your website?

Ling

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

3 participants