Commit 59e1a03f authored by David Seaward's avatar David Seaward

Merge branch 'master' of source.puri.sm:liberty/lsh_middleware into mr162

parents d7310ed9 7fbf57a7
......@@ -156,7 +156,7 @@ SPDX-License-Identifier: AGPL-3.0
<ul>
<li><a href="{% url 'password_change' %}">{% trans "Change password" %}</a></li>
<li><a href="{% url 'profile_configure' username %}">{% trans "Profile settings" %}</a></li>
<li><a href="{% url 'profile_configure' %}">{% trans "Profile settings" %}</a></li>
</ul>
</article>
......
......@@ -49,7 +49,7 @@ urlpatterns = [
limitmonitor.views.toggle_tunnel, name='toggle_tunnel'),
url(r'^accounts/profile/new_invitation',
limitmonitor.views.new_invitation, name='new_invitation'),
url(r'^accounts/profile/configure/(?P<username>.+)/$',
url(r'^accounts/profile/configure',
ProfileConfigureView.as_view(), name='profile_configure'),
# url(r'^accounts/register/$', RegistrationView.as_view(form_class=RegistrationForm), name='registration_register'),
url(r'^accounts/login/$', LdhLoginView.as_view(), name='auth_login'),
......
......@@ -10,6 +10,7 @@ from password_reset.views import Recover
from .serializers import UserSerializer
from .forms import PasswordRecoveryForm, PasswordChangeForm, \
ProfileConfigureForm
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import PasswordChangeView \
as BasePasswordChangeView
from django.contrib.auth.views import PasswordChangeDoneView \
......@@ -67,13 +68,13 @@ class PasswordChange(BasePasswordChangeView):
return context
class ProfileConfigureView(UpdateView):
class ProfileConfigureView(LoginRequiredMixin, UpdateView):
template_name = 'purist/profile_configure.html'
form_class = ProfileConfigureForm
success_url = reverse_lazy('profile')
model = User
slug_field = 'username'
slug_url_kwarg = 'username'
def get_object(self, queryset=None):
return self.request.user
def get_context_data(self, **kwargs):
context = super(ProfileConfigureView, self).get_context_data(**kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment