8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-22 15:03:45 +00:00

Merge branch 'fix_trad_and_autocapture' into 'dev'

Traductions, style et fixe de bugs sur la page d'enregistrement mac/room

See merge request federez/re2o!322
This commit is contained in:
Fardale 2018-10-05 22:00:03 +02:00
commit 92e66bb18f
5 changed files with 421 additions and 277 deletions

View file

@ -378,12 +378,12 @@ class AdherentCreationForm(AdherentForm):
+ "using the forgotten password button on the "\
+ "login page or contacting support.")
former_user_check = forms.BooleanField(required=True, help_text=former_user_check_info)
former_user_check.label = _("I have not had an account before")
former_user_check.label = _("I certifie that I have not had an account before")
# Checkbox for GTU
gtu_check = forms.BooleanField(required=True)
gtu_check.label = mark_safe("{}<a href='/media/{}' download='CGU'>{}</a>{}".format(
_("I commit to accept the "), GeneralOption.get_cached_value('GTU'), _("General Terms of Use"), _(".")))
gtu_check.label = mark_safe("{} <a href='/media/{}' download='CGU'>{}</a>{}".format(
_("I commit to accept the"), GeneralOption.get_cached_value('GTU'), _("General Terms of Use"), _(".")))
def __init__(self, *args, **kwargs):
super(AdherentCreationForm, self).__init__(*args, **kwargs)
@ -417,7 +417,7 @@ class AdherentEditForm(AdherentForm):
'shell',
'gpg_fingerprint'
]
class ClubForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Formulaire de base d'edition d'un user. Formulaire de base, utilisé
pour l'edition de self par self ou un cableur. On formate les champs
@ -730,11 +730,11 @@ class InitialRegisterForm(forms.Form):
self.nas_type = Nas.objects.filter(nas_type__interface__ipv4__ipv4=switch_ip).first()
super(InitialRegisterForm, self).__init__(*args, **kwargs)
if hasattr(self, 'new_room'):
self.fields['register_room'].label = _("New connection from room %s. Is it yours? If that is the case, type OK." % self.new_room)
self.fields['register_room'].label = _("This room is my room")
else:
self.fields.pop('register_room')
if hasattr(self, 'mac_address'):
self.fields['register_machine'].label = _("New connection from new device. Register it? Say Yes to get Internet access from it (MAC Address : %s)." % self.mac_address)
self.fields['register_machine'].label = _("This new connected device is mine")
else:
self.fields.pop('register_machine')

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
{% extends "users/sidebar.html" %}
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2017 Gabriel Détraz
Copyright © 2017 Goulven Kermarec
Copyright © 2017 Augustin Lemesle
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load bootstrap3 %}
{% load massive_bootstrap_form %}
{% load static %}
{% load i18n %}
{% block title %}{% trans "Users" %}{% endblock %}
{% block content %}
{% bootstrap_form_errors userform %}
<h2>{% blocktrans %}Device and room register form{% endblocktrans %}</h2>
<form class="form" method="post">
{% csrf_token %}
<div class="dashboard_container">
<div class="row">
<div class="col-sm-6 col-md-6">
<div class="panel panel-success">
<div class="panel-heading dashboard">{% blocktrans %}Connected from :{% endblocktrans %}</div>
<div class="panel-body dashboard">
<h5>{% blocktrans %}Room {% endblocktrans %} {{ port.room }}</h5>
<h5>{% blocktrans %}Port {% endblocktrans %} {{ port }}</h5>
<h3>{{ userform.register_room }} {{ userform.register_room.label }}</h3>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6">
<div class="panel panel-success">
<div class="panel-heading dashboard">{% blocktrans %}Connected with device :{% endblocktrans %}</div>
<div class="panel-body dashboard">
<h5>{% blocktrans %}Mac address {% endblocktrans %} {{ mac }}</h5>
<h3>{{ userform.register_machine }} {{ userform.register_machine.label }}</h3>
</div>
</div>
</div>
</div>
</div>
<center>{% bootstrap_button "Ok" button_type="submit" icon='ok' button_class='btn-success' %}</center>
</form>
<br>
<br/>
<br/>
<br/>
{% endblock %}

View file

@ -70,7 +70,7 @@ from re2o.acl import (
can_change
)
from cotisations.utils import find_payment_method
from topologie.models import Port
from .serializers import MailingSerializer, MailingMemberSerializer
from .models import (
User,
@ -133,7 +133,7 @@ def new_user(request):
'GTU_sum_up': GTU_sum_up,
'GTU': GTU,
'showCGU': True,
'action_name': _("Create a user")
'action_name': _("Commit")
},
'users/user.html',
request
@ -1085,13 +1085,18 @@ def process_passwd(request, req):
@login_required
def initial_register(request):
u_form = InitialRegisterForm(request.POST or None, user=request.user, switch_ip=request.GET.get('switch_ip', None), switch_port=request.GET.get('switch_port', None), client_mac=request.GET.get('client_mac', None))
switch_ip = request.GET.get('switch_ip', None)
switch_port = request.GET.get('switch_port', None)
client_mac = request.GET.get('client_mac', None)
u_form = InitialRegisterForm(request.POST or None, user=request.user, switch_ip=switch_ip, switch_port=switch_port, client_mac=client_mac)
if not u_form.fields:
messages.error(request, _("Incorrect URL, or already registered device"))
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
if switch_ip and switch_port:
port = Port.objects.filter(switch__interface__ipv4__ipv4=switch_ip, port=switch_port).first()
if u_form.is_valid():
messages.success(request, _("Successful registration! Please"
" disconnect and reconnect your Ethernet"
@ -1102,8 +1107,8 @@ def initial_register(request):
request
)
return form(
{'userform': u_form, 'action_name': _("Register device or room")},
'users/user.html',
{'userform': u_form, 'port': port, 'mac': client_mac},
'users/user_autocapture.html',
request
)