mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
views: add ability to force https URL in layer review emails
At the moment the URL that is presented in the review email will have http:// or https:// prefix depending on what the user who submitted the layer was using, but that's irrelevant - we actually want https:// if the server is capable of it since the reviewer may be redirected to log in (and Django's login_required decorator will always redirect to the login page if http is being used as far as I observed, which is a bit annoying if you are already logged in.) Add a setting which if enabled will substitute https:// as the prefix. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
e93eef34bd
commit
07315e0b88
|
@ -169,10 +169,13 @@ def edit_layer_view(request, template_name, branch='master', slug=None):
|
||||||
user_name = user.first_name
|
user_name = user.first_name
|
||||||
else:
|
else:
|
||||||
user_name = user.username
|
user_name = user.username
|
||||||
|
layer_url = request.build_absolute_uri(reverse('layer_review', args=(layeritem.name,)))
|
||||||
|
if getattr(settings, 'FORCE_REVIEW_HTTPS', False) and layer_url.startswith('http:'):
|
||||||
|
layer_url = 'https:' + layer_url.split(':', 1)[1]
|
||||||
d = Context({
|
d = Context({
|
||||||
'user_name': user_name,
|
'user_name': user_name,
|
||||||
'layer_name': layeritem.name,
|
'layer_name': layeritem.name,
|
||||||
'layer_url': request.build_absolute_uri(reverse('layer_review', args=(layeritem.name,))),
|
'layer_url': layer_url,
|
||||||
})
|
})
|
||||||
subject = '%s - %s' % (settings.SUBMIT_EMAIL_SUBJECT, layeritem.name)
|
subject = '%s - %s' % (settings.SUBMIT_EMAIL_SUBJECT, layeritem.name)
|
||||||
from_email = settings.SUBMIT_EMAIL_FROM
|
from_email = settings.SUBMIT_EMAIL_FROM
|
||||||
|
|
|
@ -217,6 +217,10 @@ UPDATE_PURGE_DAYS = 30
|
||||||
# Remove layer dependencies that are not specified in conf/layer.conf
|
# Remove layer dependencies that are not specified in conf/layer.conf
|
||||||
REMOVE_LAYER_DEPENDENCIES = False
|
REMOVE_LAYER_DEPENDENCIES = False
|
||||||
|
|
||||||
|
# Always use https:// for review URLs in emails (since it may be redirected to
|
||||||
|
# the login page)
|
||||||
|
FORCE_REVIEW_HTTPS = False
|
||||||
|
|
||||||
# Settings for layer submission feature
|
# Settings for layer submission feature
|
||||||
SUBMIT_EMAIL_FROM = 'noreply@example.com'
|
SUBMIT_EMAIL_FROM = 'noreply@example.com'
|
||||||
SUBMIT_EMAIL_SUBJECT = 'OE Layerindex layer submission'
|
SUBMIT_EMAIL_SUBJECT = 'OE Layerindex layer submission'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user