formatting fixes for users views

This commit is contained in:
Chris Van 2012-12-26 09:32:37 -05:00
Родитель 863b6c3e45
Коммит 8aa65d21d6
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -203,7 +203,7 @@ def edit(request):
l = {'user': amouser, l = {'user': amouser,
'mail1': original_email, 'mail1': original_email,
'mail2': amouser.email} 'mail2': amouser.email}
log.info(u"User (%(user)s) has requested email change from" log.info(u"User (%(user)s) has requested email change from "
"(%(mail1)s) to (%(mail2)s)" % l) "(%(mail1)s) to (%(mail2)s)" % l)
messages.info(request, _('Email Confirmation Sent'), messages.info(request, _('Email Confirmation Sent'),
_(u'An email has been sent to {0} to confirm your new ' _(u'An email has been sent to {0} to confirm your new '
@ -212,15 +212,14 @@ def edit(request):
'Until then, you can keep logging in with your ' 'Until then, you can keep logging in with your '
'current email address.').format(amouser.email)) 'current email address.').format(amouser.email))
domain = settings.DOMAIN token, hash_ = EmailResetCode.create(amouser.id, amouser.email)
token, hash = EmailResetCode.create(amouser.id, amouser.email) url = '%s%s' % (settings.SITE_URL,
url = "%s%s" % (settings.SITE_URL, reverse('users.emailchange',
reverse('users.emailchange', args=[amouser.id, args=[amouser.id, token, hash_]))
token, hash]))
t = loader.get_template('users/email/emailchange.ltxt') t = loader.get_template('users/email/emailchange.ltxt')
c = {'domain': domain, 'url': url} c = {'domain': settings.DOMAIN, 'url': url}
send_mail(_('Please confirm your email address ' send_mail(_('Please confirm your email address '
'change at %s' % domain), 'change at %s' % settings.DOMAIN),
t.render(Context(c)), None, [amouser.email], t.render(Context(c)), None, [amouser.email],
use_blacklist=False, real_email=True) use_blacklist=False, real_email=True)
@ -300,7 +299,7 @@ def _clean_next_url(request):
domain = gets.get('domain', None) domain = gets.get('domain', None)
if domain in settings.VALID_LOGIN_REDIRECTS.keys(): if domain in settings.VALID_LOGIN_REDIRECTS.keys():
url = "%s%s" % (settings.VALID_LOGIN_REDIRECTS[domain], url) url = settings.VALID_LOGIN_REDIRECTS[domain] + url
gets['to'] = url gets['to'] = url
request.GET = gets request.GET = gets
@ -352,6 +351,7 @@ def browserid_authenticate(request, assertion):
@transaction.commit_on_success @transaction.commit_on_success
#@ratelimit(block=True, rate=settings.LOGIN_RATELIMIT_ALL_USERS) #@ratelimit(block=True, rate=settings.LOGIN_RATELIMIT_ALL_USERS)
def browserid_login(request): def browserid_login(request):
msg = ''
if waffle.switch_is_active('browserid-login'): if waffle.switch_is_active('browserid-login'):
if request.user.is_authenticated(): if request.user.is_authenticated():
# If username is different, maybe sign in as new user? # If username is different, maybe sign in as new user?
@ -678,7 +678,7 @@ def register(request):
def report_abuse(request, user_id): def report_abuse(request, user_id):
user = get_object_or_404(UserProfile, pk=user_id) user = get_object_or_404(UserProfile, pk=user_id)
form = AbuseForm(request.POST or None, request=request) form = AbuseForm(request.POST or None, request=request)
if request.method == "POST" and form.is_valid(): if request.method == 'POST' and form.is_valid():
send_abuse_report(request, user, form.cleaned_data['text']) send_abuse_report(request, user, form.cleaned_data['text'])
messages.success(request, _('User reported.')) messages.success(request, _('User reported.'))
else: else: