-
diff --git a/account/templates/member_base.html b/account/templates/member_base.html
new file mode 100644
index 0000000..c2f1be4
--- /dev/null
+++ b/account/templates/member_base.html
@@ -0,0 +1,43 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block body %}
+
+
+ {% block container %}{% endblock container %}
+
+
+
+ Copyright © 2013 by c-base e.V.
+
+
+{% endblock body %}
diff --git a/account/templates/password.html b/account/templates/password.html
new file mode 100644
index 0000000..f81d9a9
--- /dev/null
+++ b/account/templates/password.html
@@ -0,0 +1,23 @@
+{% extends "form_base.html" %}
+{% load i18n %}
+{% load crispy_forms_tags %}
+
+{% block form_title %}{% trans "Password"%}{% endblock %}
+
+{% block form_description %}
+
{% blocktrans %}You can change your password here.{% endblocktrans %}
+{% endblock %}
+
+{% block form_fields %}
+ {{ form.non_field_errors }}
+
+ {% csrf_token %}
+ {{ form|crispy }}
+
+
+
+ {% trans "Save"%}
+
+
+
+{% endblock form_fields %}
\ No newline at end of file
diff --git a/account/templates/sippin.html b/account/templates/sippin.html
new file mode 100644
index 0000000..b894a1d
--- /dev/null
+++ b/account/templates/sippin.html
@@ -0,0 +1,23 @@
+{% extends "form_base.html" %}
+{% load i18n %}
+{% load crispy_forms_tags %}
+
+{% block form_title %}{% trans "SIP PIN"%}{% endblock %}
+
+{% block form_description %}
+
{% blocktrans %}The SIP PIN is your access to the c-base SIP server for voice telephony.{% endblocktrans %}
+{% endblock %}
+
+{% block form_fields %}
+ {{ form.non_field_errors }}
+
+ {% csrf_token %}
+ {{ form|crispy }}
+
+
+
+ {% trans "Save"%}
+
+
+
+{% endblock form_fields %}
\ No newline at end of file
diff --git a/account/templates/start.html b/account/templates/start.html
new file mode 100644
index 0000000..c2b7861
--- /dev/null
+++ b/account/templates/start.html
@@ -0,0 +1,51 @@
+{% extends "member_base.html" %}
+{% load i18n %}
+
+{% block container %}
+
+
+
{% trans "Welcome to the c-base member interface" %}
+
{% blocktrans %}Here you can change
+ some parameters of your c-base member account.{% endblocktrans %}
+
+
{% trans "Basic information about your account" %}
+
+
+
+ {% trans "Your user ID:" %}
+ {{ member.uid }}
+ {% trans "Numeric user ID:" %}
+ {{ member.uidNumber }}
+ {% blocktrans %}The numeric user ID can be used to login with
+ the vending machines and network connected combination
+ locks.{% endblocktrans %}
+
+ {% trans "Your c-base e-mail address:" %}
+ {{ member.mail }}
+
+
+
+
{% trans "Management information" %}
+
+
+ {% trans "Name:" %}
+ {{ member.displayName }}
+
+
+ {% trans "External e-mail address:" %}
+ {{ member.externalEmail }}
+ {% blocktrans %}The external e-mail address is used by the
+ board of c-base to reach you in cases where your c-base
+ address (see above) is not working. To change your
+ externe e-mail address please contact the c-base board
+ (vorstand@c-base.org ).{% endblocktrans %}
+
+
+ {% trans "Your c-base member account balance:" %}
+ {% trans "Check balance" %}
+
+
+
+
+
+{% endblock container %}
\ No newline at end of file
diff --git a/account/urls.py b/account/urls.py
index 755e7f5..f904146 100644
--- a/account/urls.py
+++ b/account/urls.py
@@ -3,11 +3,14 @@ from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
- url(r'^login/$', 'account.views.auth_login', name="auth_login"),
+ url(r'^login/$', 'account.views.auth_login', name="cbase_auth_login"),
url(r'^logout/$', 'account.views.auth_logout', name="auth_logout"),
url(r'^gastropin/$', 'account.views.gastropin', name='gastropin'),
url(r'^wlan_presence/$', 'account.views.wlan_presence', name='wlan_presence'),
url(r'^rfid/$', 'account.views.rfid', name='rfid'),
- url(r'^nrf24/$', 'account.views.nrf24', name='rfid'),
+ url(r'^nrf24/$', 'account.views.nrf24', name='nrf24'),
+ url(r'^password/$', 'account.views.password', name='password'),
+ url(r'^sippin/$', 'account.views.sippin', name='sippin'),
+ url(r'^$', 'account.views.home', name="home"),
url(r'^groups/(?P
[^/]+)/', 'account.views.groups_list'),
)
\ No newline at end of file
diff --git a/account/views.py b/account/views.py
index 4dd1fa2..c50f831 100644
--- a/account/views.py
+++ b/account/views.py
@@ -12,10 +12,34 @@ from django.contrib.auth.models import Group
from django.shortcuts import render
from django.utils.translation import ugettext as _
-from forms import GastroPinForm, WlanPresenceForm, LoginForm, PaswordForm, \
- RFIDForm, NRF24Form
+from forms import GastroPinForm, WlanPresenceForm, LoginForm, PasswordForm, \
+ RFIDForm, NRF24Form, SIPPinForm
from cbase_members import MemberValues, retrieve_member
+
+def landingpage(request):
+ if request.user.is_authenticated():
+ return HttpResponseRedirect('/account')
+ form = LoginForm()
+ is_ceymaster = is_admin = False
+ if 'ceymaster' in [g.name for g in request.user.groups.all()]:
+ is_ceymaster = True
+ if 'ldap_admins' in [g.name for g in request.user.groups.all()]:
+ is_admin = True
+ groups = Group.objects.all()
+ admins = Group.objects.get(name="ldap_admins").user_set.all()
+
+ # values = get_user_values(request.user.username, request.session['ldap_password'])
+ #return render_to_response("dashboard.html", locals())
+ return render(request, 'base.html', {'form': form, 'admins': admins})
+
+@login_required
+def home(request):
+ member = retrieve_member(request)
+ context = {'member': member.to_dict()}
+ print context
+ return render(request, 'start.html', context)
+
def auth_login(request):
redirect_to = request.GET.get('next', '') or '/'
if request.method == 'POST':
@@ -44,6 +68,7 @@ def auth_login(request):
return render_to_response('login.html',
RequestContext(request, locals()))
+@login_required
def auth_logout(request):
redirect_to = request.GET.get('next', '') or '/'
logout(request)
@@ -51,19 +76,6 @@ def auth_logout(request):
response.delete_cookie('sessionkey')
return response
-def landingpage(request):
- is_ceymaster = is_admin = False
- if 'ceymaster' in [g.name for g in request.user.groups.all()]:
- is_ceymaster = True
- if 'ldap_admins' in [g.name for g in request.user.groups.all()]:
- is_admin = True
- groups = Group.objects.all()
- admins = Group.objects.get(name="ldap_admins").user_set.all()
- if request.user.is_authenticated():
- # values = get_user_values(request.user.username, request.session['ldap_password'])
- return render_to_response("dashboard.html", locals())
- return render_to_response("base.html", locals())
-
@login_required(redirect_field_name="/" ,login_url="/account/login/")
def groups_list(request, group_name):
group = get_object_or_404(Group, name=group_name)
@@ -76,24 +88,13 @@ def groups_list(request, group_name):
@login_required
def gastropin(request):
- if request.method == 'POST':
- form = GastroPinForm(request.POST)
- if form.is_valid():
- user = request.user
- user_profile = user.get_profile()
- user_profile.gastropin = form.cleaned_data['gastropin']
- user_profile.save()
- return render(request, 'gastropin.html',
- {'message': _('Your Gastro-PIN was changed. Thank you!'),
- 'form:': form})
- else:
- return render(request, 'gastropin.html', {'form:': form})
-
- else:
- form = GastroPinForm()
-
- return render(request, 'gastropin.html', {'form': form})
+ return set_ldap_field(request, GastroPinForm,
+ [('gastropin', 'gastropin')], 'gastropin.html')
+@login_required
+def sippin(request):
+ return set_ldap_field(request, SIPPinForm, [('sippin', 'sippin')],
+ 'sippin.html')
def set_ldap_field(request, form_type, field_names, template_name):
"""
@@ -135,4 +136,7 @@ def rfid(request):
def nrf24(request):
return set_ldap_field(request, NRF24Form, [('nrf24', 'nrf24')], 'nrf24.html')
+@login_required
+def password(request):
+ return set_ldap_field(request, PasswordForm, [('password1', 'password')], 'password.html')
diff --git a/cbmi/templates/base.html b/cbmi/templates/base.html
index c3dc12b..aecd898 100644
--- a/cbmi/templates/base.html
+++ b/cbmi/templates/base.html
@@ -1,4 +1,6 @@
{% load i18n %}
+{% load crispy_forms_tags %}
+
@@ -64,33 +66,18 @@
{% block body %}
-
{% block container %}
-
+
c-base member-interface
- Auf dieser Seite kann jedes Member seine LDAP-Daten editieren und u.A. sein Passwort neu setzen.
+ {% blocktrans %}On this website any member can view and
+ edit their data stored in the LDAP directory of
+ c-base.{% endblocktrans %}
- neumember können sich ihr initiales passwort mit einem der folgenden member setzen:
+ {% blocktrans %}If you are a new member and don't have a
+ password yet, please contact one of the following people:{% endblocktrans %}
{% for admin in admins %}
{{ admin}}
@@ -98,6 +85,21 @@
+
+
+
Login
+
+ {% csrf_token %}
+ {{ form|crispy }}
+
+
+ {% trans "Save" %}
+
+
+
+
+
{% endblock container %}
diff --git a/cbmi/urls.py b/cbmi/urls.py
index 10bebbb..e52b3b9 100644
--- a/cbmi/urls.py
+++ b/cbmi/urls.py
@@ -11,6 +11,6 @@ urlpatterns = patterns('',
url(r'account/', include('account.urls')),
- url(r'^$', 'account.views.landingpage'),
+ url(r'^$', 'account.views.landingpage', name="landingpage"),
)