Added password changing for non-ldap user
This commit is contained in:
parent
b458cfaead
commit
eaf1551fa1
|
@ -3,7 +3,21 @@
|
||||||
{% block "content" %}
|
{% block "content" %}
|
||||||
<div style="width:800px">
|
<div style="width:800px">
|
||||||
<h1>Passwort</h1>
|
<h1>Passwort</h1>
|
||||||
Da die meisten der Nutzer dieses Systems über den LDAP der Freitagsrunde laufen, kann man hier sein Passwort nicht ändern. Wenn du dein Passwort trotzdem ändern möchstest (und dieses System nicht über einen Freitagsrundenaccount benutzt), wende dich bitte an einen der Freitagsrunden-Admins. (lies: not implemented)
|
<br />
|
||||||
|
{% if form %}
|
||||||
|
{% if password_success %}
|
||||||
|
{{ password_success }} <br />
|
||||||
|
{% endif %}
|
||||||
|
<table>
|
||||||
|
<form method="post" action="#">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form }}
|
||||||
|
<tr><th align="center" colspan="2"><input type="submit" value="Ändern" /></th></tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
Da du dich nicht über Django authentifizierst (sondern z.B. über LDAP) kannst du dein Passwort hier nicht ändern.
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div style="width:800px; margin-top: 25px">
|
<div style="width:800px; margin-top: 25px">
|
||||||
<h1>Pluginberechtigungen</h1>
|
<h1>Pluginberechtigungen</h1>
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from main.models import Plugin, PluginPermission
|
from main.models import Plugin, PluginPermission
|
||||||
|
from django.contrib.auth.forms import PasswordChangeForm
|
||||||
from buyable.models import Purchase, Buyable, BuyableType
|
from buyable.models import Purchase, Buyable, BuyableType
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -62,12 +62,23 @@ def getPluginDict(request):
|
||||||
unallowed = Plugin.objects.exclude(pluginpermission__user=request.user)
|
unallowed = Plugin.objects.exclude(pluginpermission__user=request.user)
|
||||||
perms = PluginPermission.objects.filter(user=request.user)
|
perms = PluginPermission.objects.filter(user=request.user)
|
||||||
|
|
||||||
return {'plugins': plugins, 'allowed': allowed, 'unallowed': unallowed, 'permissions': perms}
|
form = None
|
||||||
|
if request.user.has_usable_password():
|
||||||
|
form = PasswordChangeForm(request.user)
|
||||||
|
|
||||||
|
return {'plugins': plugins, 'allowed': allowed, 'unallowed': unallowed, 'permissions': perms, 'form': form}
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def settings(request):
|
def settings(request):
|
||||||
""" Render settings page. """
|
""" Render settings page. """
|
||||||
return render_to_response("settings/settings.html", getPluginDict(request), RequestContext(request))
|
pdict = getPluginDict(request)
|
||||||
|
if request.method == "POST":
|
||||||
|
form = PasswordChangeForm(request.user, data=request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
form.save()
|
||||||
|
pdict['password_success'] = "Es wurde ein neues Passwort gesetzt."
|
||||||
|
pdict['form'] = form
|
||||||
|
return render_to_response("settings/settings.html", pdict, RequestContext(request))
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def pluginPermission(request, method, pluginId):
|
def pluginPermission(request, method, pluginId):
|
||||||
|
|
Loading…
Reference in New Issue