diff --git a/account/forms.py b/account/forms.py index 7bf72f1..ce32ab5 100644 --- a/account/forms.py +++ b/account/forms.py @@ -42,6 +42,7 @@ class PasswordForm(forms.Form): class RFIDForm(forms.Form): rfid = forms.CharField(max_length=255, help_text=_('Your RFID')) + class SIPPinForm(forms.Form): sippin = forms.CharField(max_length=255, help_text=_('Your SIP PIN')) @@ -49,3 +50,7 @@ class SIPPinForm(forms.Form): class NRF24Form(forms.Form): nrf24 = forms.CharField(max_length=255, help_text=_('Your NRF24 identification')) + + +class CLabPinForm(forms.Form): + c_lab_pin = GastroPinField(help_text=_('Your c-lab PIN')) \ No newline at end of file diff --git a/account/templates/clabpin.html b/account/templates/clabpin.html new file mode 100644 index 0000000..13213ef --- /dev/null +++ b/account/templates/clabpin.html @@ -0,0 +1,23 @@ +{% extends "form_base.html" %} +{% load i18n %} +{% load crispy_forms_tags %} + +{% block form_title %}{% trans "c-lab PIN"%}{% endblock %} + +{% block form_description %} +

{% blocktrans %}Change your c-lab PIN to access the c-lab in the basement.{% endblocktrans %}

+{% endblock %} + +{% block form_fields %} + {{ form.non_field_errors }} +
+ {% csrf_token %} + {{ form|crispy }} + +
+
+ +
+
+
+{% endblock form_fields %} \ No newline at end of file diff --git a/account/templates/gastropin.html b/account/templates/gastropin.html index ecade02..67f7b9d 100644 --- a/account/templates/gastropin.html +++ b/account/templates/gastropin.html @@ -5,7 +5,12 @@ {% block form_title %}{% trans "Gastro PIN"%}{% endblock %} {% block form_description %} -

{% blocktrans %}Change your Gastro PIN to access the vending machines.{% endblocktrans %}

+ +

{% blocktrans %}Change your Gastro PIN to access the vending machines. + To use unlock member prices, press the A button then enter + your numeric user ID{% endblocktrans %} + {{ member.uidNumber }} + {% blocktrans %}and your Gastro PIN.{% endblocktrans %}

{% endblock %} {% block form_fields %} diff --git a/account/templates/login.html b/account/templates/login.html index 615cb97..8539c65 100644 --- a/account/templates/login.html +++ b/account/templates/login.html @@ -9,7 +9,8 @@
-
+
+

Login

{% csrf_token %} {{ form|crispy }} @@ -21,5 +22,9 @@
+
+
+ Copyright © 2013 by c-base e.V. +
{% endblock body %} diff --git a/account/templates/member_base.html b/account/templates/member_base.html index c2f1be4..67bfd7d 100644 --- a/account/templates/member_base.html +++ b/account/templates/member_base.html @@ -24,6 +24,10 @@
  • {% trans "RFID" %}
  • + {% url account.views.clabpin as clab_url %} +
  • + {% trans "c-lab-PIN" %} +
  • {% url account.views.nrf24 as nrf24_url %}
  • {% trans "NRF24" %} diff --git a/account/urls.py b/account/urls.py index f904146..cb721bd 100644 --- a/account/urls.py +++ b/account/urls.py @@ -11,6 +11,7 @@ urlpatterns = patterns( 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'^clabpin/$', 'account.views.clabpin', name='clabpin'), 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 c50f831..222e886 100644 --- a/account/views.py +++ b/account/views.py @@ -13,7 +13,7 @@ from django.shortcuts import render from django.utils.translation import ugettext as _ from forms import GastroPinForm, WlanPresenceForm, LoginForm, PasswordForm, \ - RFIDForm, NRF24Form, SIPPinForm + RFIDForm, NRF24Form, SIPPinForm, CLabPinForm from cbase_members import MemberValues, retrieve_member @@ -113,15 +113,17 @@ def set_ldap_field(request, form_type, field_names, template_name): member.save() new_form = form_type(initial=initial) return render(request, template_name, - {'message': _('Your changes have been saved. Thank you!'), - 'form': new_form}) + {'message': _('Your changes have been saved. Thank you!'), + 'form': new_form, 'member': member.to_dict()}) else: - return render(request, template_name, {'form:': form}) + return render(request, template_name, + {'form:': form, 'member': member.to_dict()}) else: for form_field, ldap_field in field_names: initial[form_field] = member.get(ldap_field) form = form_type(initial=initial) - return render(request, template_name, {'form': form}) + return render(request, template_name, + {'form': form, 'member': member.to_dict()}) @login_required def wlan_presence(request): @@ -138,5 +140,11 @@ def nrf24(request): @login_required def password(request): - return set_ldap_field(request, PasswordForm, [('password1', 'password')], 'password.html') + return set_ldap_field(request, PasswordForm, [('password1', 'password')], + 'password.html') + +@login_required +def clabpin(request): + return set_ldap_field(request, CLabPinForm, [('c_lab_pin', 'c-labPIN')], + 'clabpin.html') diff --git a/cbmi/templates/base.html b/cbmi/templates/base.html index aecd898..e30f8b3 100644 --- a/cbmi/templates/base.html +++ b/cbmi/templates/base.html @@ -38,10 +38,12 @@ - + {% trans "c-base Member Interface" %} {% endblock container %} +
    +
    + Copyright © 2013 by c-base e.V. +
    {% endblock body %}