{% endblock %}
{% block content %}
- <form action='.' method='post'>
+ <form action='{% url login %}' method='post'>
<fieldset>
<legend>Log in to your account</legend>
{% if errors %}
from cas_provider.views import *
urlpatterns = patterns('',
- url(r'^login/$', login),
- url(r'^validate/$', validate),
- url(r'^serviceValidate/$', service_validate),
- url(r'^logout/$', logout),
-)
\ No newline at end of file
+ url(r'^login/?$', login, name='cas_login'),
+ url(r'^validate/?$', validate),
+ url(r'^serviceValidate/?$', service_validate),
+ url(r'^logout/?$', logout),
+)
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth import login as auth_login, logout as auth_logout
+from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
from cas_provider.forms import LoginForm
def _add_query_param(url, param, value):
parsed = urlparse.urlparse(url)
- query = url_parse_qs(parsed.query)
+ query = url_parse_qs(smart_str(parsed.query))
query[param] = [unicode(value, 'utf-8')]
query = [ ((k, v) if len(v) != 1 else (k, v[0])) for k, v in query.iteritems() ]
parsed = urlparse.ParseResult(parsed.scheme, parsed.netloc,
except template.VariableDoesNotExist:
return ''
- gravatar_url = "http://www.gravatar.com/avatar/" + hashlib.md5(email).hexdigest() + "?"
+ gravatar_url = "https://www.gravatar.com/avatar/" + hashlib.md5(email).hexdigest() + "?"
gravatar_url += urllib.urlencode({'default': 'mm', 'size': str(self.size)})
return gravatar_url
{% block content %}
- <form action='.' method='post'>
+ <form action='{% url cas_login %}' method='post'>
<h1>{% trans "Login" %}</h1>
{% for error in errors %}