зеркало из https://github.com/mozilla/bedrock.git
Merge branch 'master' of github.com:mozilla/bedrock
This commit is contained in:
Коммит
6746a6305d
|
@ -40,6 +40,18 @@
|
|||
|
||||
{% if not submitted %}
|
||||
<form class="container" id="apps-email-form" action="#apps-email-form" method="post">
|
||||
|
||||
{% if error %}
|
||||
<ul class="form-errors">
|
||||
{% if error == 'email' %}
|
||||
<li>Please enter a valid email address.</li>
|
||||
{% elif error == 'privacy' %}
|
||||
<li>Please read the Mozilla Privacy Policy and agree by checking
|
||||
the box.</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<h3>Email signup</h3>
|
||||
<div class="row">
|
||||
|
||||
|
|
|
@ -6,22 +6,25 @@ import basket
|
|||
|
||||
def marketplace(request):
|
||||
submitted = False
|
||||
form_error = False
|
||||
error = False
|
||||
email = ''
|
||||
|
||||
if request.method == 'POST':
|
||||
email = request.POST['email']
|
||||
newsletter = 'app-dev'
|
||||
|
||||
if email_re.match(email):
|
||||
if not email_re.match(email):
|
||||
error = 'email'
|
||||
|
||||
if not request.POST.get('privacy', None):
|
||||
error = 'privacy'
|
||||
|
||||
if not error:
|
||||
basket.subscribe(email, newsletter)
|
||||
submitted = True
|
||||
else:
|
||||
form_error = True
|
||||
|
||||
|
||||
return l10n_utils.render(request,
|
||||
"marketplace/marketplace.html",
|
||||
{'submitted': submitted,
|
||||
'form_error': form_error,
|
||||
'error': error,
|
||||
'email': email})
|
||||
|
|
Загрузка…
Ссылка в новой задаче