Commit 06a285b1 authored by ljf's avatar ljf

Merge branch 'jd-fix-212-transmission-secrets-vpn' into 'master'

Corrige l'affichage des secrets à l'utilisateur pour l'app VPN

Closes #212

See merge request ffdn/coin!9
parents 3b151b9b 36fa098b
......@@ -401,11 +401,6 @@ MEMBERSHIP_FEE_REMINDER_DATES = [
- `HANDLE_BALANCE`: Allows to handle money balances for members (False default)
- `INVOICES_INCLUDE_CONFIG_COMMENTS`: Add comment related to a subscription configuration when generating invoices
- `MEMBER_CAN_EDIT_VPN_CONF`: Allow members to edit some part of their vpn configuration
- `MAILLIST_SYNC_COMMAND` : The command to send the list of mail addresses of a
given mailling list to mail list server. The command will receives one
address/line on stdin. This setting could use placholders:
- `{email}`: the mail address of the list
- `{short_name}`: the list name
- `DEBUG` : Enable debug for development **do not use in production** : display
stracktraces and enable [django-debug-toolbar](https://django-debug-toolbar.readthedocs.io).
- `SITE_TITLE`: the base of site title (displayed in browser window/tab title)
......@@ -414,6 +409,30 @@ MEMBERSHIP_FEE_REMINDER_DATES = [
- `SUBSCRIPTIONS_NOTIFICATION_EMAILS` : Emails on which to send notifications
uppon new registration.
### Optional apps settings
See also [using optional apps](#using-optional-apps).
#### maillists
- `MAILLIST_SYNC_COMMAND` : The command to send the list of mail addresses of a
given mailling list to mail list server. The command will receives one
address/line on stdin. This setting could use placholders:
- `{email}`: the mail address of the list
- `{short_name}`: the list name
#### vpn
- `VPN_SECRETS_TRANSMISSION_METHOD` : how are VPN secrets transmited to
subscriber ? Two values are currently supported :
- `gen-password-and-forget` (default, used by Illyse) : generate a
password, push it to LDAP (which holds VPN auth), displays it to user and
forget it.
- `crypto-link` (used by ARN) : credentials are generated by an admin
outside coin, and put on an encrypted burn-after-reading web page, whom
URL is filled-in coin.
Accounting logs
---------------
......
......@@ -327,6 +327,9 @@ MEMBER_CAN_EDIT_VPS_CONF = True
# Allow user to edit their VPN Info
MEMBER_CAN_EDIT_VPN_CONF = True
# vpn app settings : how do we transmit the VPN secrets to subscriber ?
VPN_SECRETS_TRANSMISSION_METHOD = 'gen-password-and-forget'
# Account registration
# Allow visitor to join the association by register on COIN
REGISTRATION_OPEN = False
......
......@@ -4,6 +4,7 @@ from __future__ import unicode_literals
from django.db import models
from django.core.exceptions import ValidationError
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from netfields import InetAddressField, NetManager
import ldapdb.models
......@@ -48,6 +49,17 @@ class VPNConfiguration(CoinLdapSyncMixin, Configuration):
null=True, help_text="Lien à usage unique (détruit après ouverture)")
objects = NetManager()
METHOD_CRYPTO_LINK = 'crypto-link'
METHOD_GEN_PASSWORD_AND_FORGET = 'gen-password-and-forget'
SECRETS_TRANSMISSION_METHOD = settings.VPN_SECRETS_TRANSMISSION_METHOD
if SECRETS_TRANSMISSION_METHOD not in (
METHOD_CRYPTO_LINK, METHOD_GEN_PASSWORD_AND_FORGET):
raise ImproperlyConfigured(
'Invalid value for VPN_SECRETS_TRANSMISSION_METHOD setting: {}'.format(
SECRETS_TRANSMISSION_METHOD))
def get_absolute_url(self):
return reverse('vpn:details', args=[str(self.pk)])
......
......@@ -32,18 +32,26 @@
<td class="center"><span class="label">Identifiant</span></td>
<td>{{object.login}}</td>
</tr>
{% if object.password %}
{% if object.SECRETS_TRANSMISSION_METHOD == object.METHOD_GEN_PASSWORD_AND_FORGET %}
<tr>
<td class="center" colspan="2">
<a class="button tiny radius" id="passgen" href="{% url 'vpn:generate_password' object.pk %}"><i class="fa fa-refresh"></i>
Générer un nouveau mot de passe</a>
Générer un nouveau mot de passe</a>
</td>
</tr>
{% endif %}
{% if object.crypto_link %}
{% if object.SECRETS_TRANSMISSION_METHOD == object.METHOD_CRYPTO_LINK %}
<tr>
<td class="center"><span class="label">Matériel cryptographique</span></td>
<td><a href="{{object.crypto_link}}">Télecharger (lien supprimé après ouverture)</a></td>
<td>
{% if object.crypto_link %}
<a href="{{object.crypto_link}}">Télecharger (lien supprimé après ouverture)</a>
{% else %}
Ton matériel cryptographique n'a pas encore été généré.
{% endif %}
</td>
</tr>
{% endif %}
<tr class="flatfield">
......
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