55 Commits e7350b0169 ... 947cd5b913

Author SHA1 Message Date
  Grégoire Jadi 947cd5b913 Add test_ldap with minimal ldap configuration for dev 6 years ago
  Grégoire Jadi 0608061088 Use unicode instead of bytes in ldap 6 years ago
  Grégoire Jadi f34dded13f WIP upgrade requirements.txt 6 years ago
  Grégoire Jadi 3d1300ebeb Fix django-ldapdb upper version limit in requirements.txt 6 years ago
  Baptiste Jonglez 571e052e98 License the project under AGPLv3 6 years ago
  Jocelyn Delalande 0ba8bb06dd Fix typo 6 years ago
  Jocelyn Delalande dd9194355b Make the membership fee reminders configurable 6 years ago
  jocelyn 6339fd94b8 Merge branch 'jd-auto-member-status' of FFDN/coin into master 6 years ago
  alexAubin 18ab9a362a Merge branch 'jd-doc-screenshot' of FFDN/coin into master 6 years ago
  jocelyn 315f86583b Merge branch 'fix-orga-registration' of ARN/coin into master 6 years ago
  Jocelyn Delalande 31a5a7c609 Merge remote-tracking branch 'irina11y/master' 6 years ago
  Grégoire Jadi e7350b0169 Add test_ldap with minimal ldap configuration for dev 6 years ago
  ljf 636a4ca01a [fix] Error on organization registration 7 years ago
  irina11y 52b5974e2b Merge branch 'TVA' of irina11y/coin into master 6 years ago
  Irina LAMBLA a34d4a2f57 Dates dans les filtres 6 years ago
  Irina LAMBLA 5e0388637a TVA non applicable 6 years ago
  jocelyn dd0345b976 Merge branch 'jd-debug-toolbar' of FFDN/coin into master 6 years ago
  Jocelyn Delalande 53895f5637 Add django-debug-toolbar to the project 6 years ago
  Jocelyn Delalande b21f3f57fd Delete unprotected endpoint 6 years ago
  Jocelyn Delalande 0ae27528d6 Merge remote-tracking branch 'ARN/vpncrypto' 6 years ago
  Irina LAMBLA f4d0525d69 Recherche dans les factures 6 years ago
  Jocelyn Delalande 175b96d849 Automatically switch member status to 'member' on membership payment 6 years ago
  Jocelyn Delalande 545b7f675b Merge branch 'registration' 6 years ago
  Jocelyn Delalande af72eadafb Set self-registered members to « pending » status. 6 years ago
  Jocelyn Delalande d7e6c85a45 Typos and unused imports 6 years ago
  jocelyn f7db55bb0a Merge branch 'master' of irina11y/coin into master 6 years ago
  Grégoire Jadi b105337f2d Use unicode instead of bytes in ldap 6 years ago
  Irina LAMBLA c06fccd520 Meilleure traduction pour ISP et offers 6 years ago
  Grégoire Jadi a34accb6b8 WIP upgrade requirements.txt 6 years ago
  Grégoire Jadi cbf099bfc0 Fix django-ldapdb upper version limit in requirements.txt 6 years ago
  ljf 49c560d293 [enh] Add comment 6 years ago
  ljf 7048ae111d Merge 6 years ago
  ljf 5316c27082 [enh] Add documentation 6 years ago
  ljf 46201f61ed [enh] Add anti bot feature 6 years ago
  Irina LAMBLA 736b641339 Traduction DSL lines 6 years ago
  Irina LAMBLA 1e0cfccd58 traduction des libellés des app dans admin. 6 years ago
  ljf 9aa1495bcd [fix] Remove deprecated render_to_response 6 years ago
  ljf ab5f9cbd11 [fix] Keep the previous title 6 years ago
  ljf 72257f802b [enh] Rename MEMBER_DEFAULT_COTISATION 6 years ago
  ljf 0659ffdf68 Merge with master 6 years ago
  Jocelyn Delalande e9ca7c7903 Add a screenshot in README 6 years ago
  root 7f9a763980 Merge with master 7 years ago
  ljf 80eff6047d [enh] Display a textarea for comment 7 years ago
  ljf 7468816c3c [enh] Add a way to transmit a private key to user 7 years ago
  ljf b9ce62e9d8 [enh] Remove deprecated function 7 years ago
  ljf bfda9397bf [enh] Adapt some text to be more generic 7 years ago
  ljf b0e4cb61d1 [fix] Remove some dead code and deactivate registration by default 7 years ago
  ljf a8866c6e09 [enh] Adapt some text to be more generic 7 years ago
  ljf b93e314817 [enh] Document new settings 7 years ago
  ljf 1c25a8b6d0 [fix] remove weird space 7 years ago
  ljf 0a415d75a7 [enh] Documentation about new settings 8 years ago
  ljf 9952138f64 [fix] Add unlisted debian dependencies in README 8 years ago
  ljf f402d92652 [fix] COmplete requirements list 8 years ago
  ljf ddce12237d [fix] Display correctly the bank transfer label 8 years ago
  ljf 712d4235eb [enh] Allow visitor to create an account 8 years ago
48 changed files with 1192 additions and 89 deletions
  1. 661 0
      LICENSE
  2. 30 1
      README.md
  3. 1 0
      coin/billing/__init__.py
  4. 3 1
      coin/billing/admin.py
  5. 9 0
      coin/billing/app.py
  6. 3 0
      coin/billing/templates/billing/invoice_pdf.html
  7. 0 2
      coin/billing/urls.py
  8. 2 9
      coin/billing/views.py
  9. 2 0
      coin/configuration/forms.py
  10. 1 0
      coin/isp_database/__init__.py
  11. 9 0
      coin/isp_database/app.py
  12. 1 0
      coin/members/__init__.py
  13. 8 0
      coin/members/app.py
  14. 41 1
      coin/members/forms.py
  15. 4 5
      coin/members/management/commands/call_for_membership_fees.py
  16. 1 1
      coin/members/migrations/0003_auto_20141007_0956.py
  17. 1 1
      coin/members/migrations/0004_auto_20141007_1002.py
  18. 17 4
      coin/members/models.py
  19. 21 0
      coin/members/registration_views.py
  20. 8 0
      coin/members/templates/members/registration/activate.html
  21. 18 0
      coin/members/templates/members/registration/activation_complete.html
  22. 12 0
      coin/members/templates/members/registration/activation_email.txt
  23. 1 0
      coin/members/templates/members/registration/activation_email_subject.txt
  24. 11 4
      coin/members/templates/members/registration/login.html
  25. 6 0
      coin/members/templates/members/registration/registration_closed.html
  26. 6 0
      coin/members/templates/members/registration/registration_complete.html
  27. 65 0
      coin/members/templates/members/registration/registration_form.html
  28. 18 3
      coin/members/tests.py
  29. 44 3
      coin/members/urls.py
  30. 24 17
      coin/members/views.py
  31. 2 0
      coin/mixins.py
  32. 1 0
      coin/offers/__init__.py
  33. 9 0
      coin/offers/app.py
  34. 37 1
      coin/settings_base.py
  35. 5 0
      coin/static/css/local.css
  36. 7 0
      coin/urls.py
  37. 3 4
      coin/views.py
  38. 1 1
      contrib/ansible/coin-customizations/django_local_settings.py.j2
  39. BIN
      doc/_img/user-subscriptions.png
  40. 2 0
      requirements.txt
  41. 1 0
      simple_dsl/__init__.py
  42. 9 0
      simple_dsl/app.py
  43. 2 3
      simple_dsl/models.py
  44. 1 1
      vpn/apps.py
  45. 19 0
      vpn/migrations/0002_vpnconfiguration_crypto_link.py
  46. 2 2
      vpn/models.py
  47. 56 24
      vpn/templates/vpn/vpn.html
  48. 7 1
      vpn/views.py

+ 661 - 0
LICENSE

@@ -0,0 +1,661 @@
+                    GNU AFFERO GENERAL PUBLIC LICENSE
+                       Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+  A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate.  Many developers of free software are heartened and
+encouraged by the resulting cooperation.  However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+  The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community.  It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server.  Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+  An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals.  This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU Affero General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Remote Network Interaction; Use with the GNU General Public License.
+
+  Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software.  This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time.  Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source.  For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code.  There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<https://www.gnu.org/licenses/>.

+ 30 - 1
README.md

@@ -4,6 +4,9 @@ The COIN project
 `Coin` is Illyse's Information System, designed to manage both members
 and Internet accesses, such as through DSL, VPN, wireless…
 
+
+![example of a coin user view : the subscriptions list](doc/_img/user-subscriptions.png)
+
 It is written in Django, and features a generic configuration interface,
 which allows to implement custom backends for different technologies.
 Currently implemented is a LDAP-based backend for OpenVPN, and a very
@@ -19,6 +22,11 @@ The project page (issue, wiki, etc) is here:
 
 A mailing list is available, for both users and developers: https://listes.illyse.org/wws/info/si
 
+License
+=======
+
+Coin is released under the GNU Affero GPL 3.0 license.  See `LICENSE` for details.
+
 Extending Coin
 ==============
 
@@ -50,7 +58,7 @@ Install dependencies. On Debian, you will probably need the
 `python-dev`, `python-pip`, `libldap-dev`, `libpq-dev`, `libsasl2-dev`,
 and `libjpeg-dev` packages.
 
-    sudo apt-get install python-dev python-pip libldap2-dev libpq-dev libsasl2-dev libjpeg-dev libxml2-dev libxslt1-dev libffi-dev
+    sudo apt-get install python-dev python-pip libldap2-dev libpq-dev libsasl2-dev libjpeg-dev libxml2-dev libxslt1-dev libffi-dev python-cairo libpango1.0-0
 
 You need a recent *pip* for the installation of dependencies to work. If you
 don't meet that requirement (Ubuntu trusty does not), run:
@@ -339,11 +347,32 @@ List of available settings in your `settings_local.py` file.
 - `EXTRA_TEMPLATE_DIRS`: See *Customizing templates*
 - `LDAP_ACTIVATE`: See *LDAP*
 - `MEMBER_MEMBERSHIP_INFO_URL`: Link to a page with information on how to become a member or pay the membership fee
+
+- `MEMBERSHIP_FEE_REMINDER_DATES`: how long before/after the membership fee
+  anniversary date we want to send a reminder email to the member. It defaults
+  to the following:
+
+```
+MEMBERSHIP_FEE_REMINDER_DATES = [
+    {'months': -3},  # 3 months before
+    {'months': -2},  # 2 months before
+    {'months': -1},  # 1 month before
+    {'days': 0},     # the day of anniversary
+    {'months': +1},  # 1 month after
+]
+```
 - `SUBSCRIPTION_REFERENCE`: Pattern used to display a unique reference for any subscription. Helpful for bank wire transfer identification
+- `REGISTRATION_OPEN` : Allow visitor to join the association by register on COIN
+- `ACCOUNT_ACTIVATION_DAYS` : All account with unvalidated email will be deleted after X days
+- `MEMBERSHIP_REFERENCE` : Template string to display the label the member should indicates for the bank transfer, default: "ADH-{{ user.pk }}"
+- `DEFAULT_MEMBERSHIP_FEE` : Default membership fee, if you have a more complex membership fees policy, you could overwrite templates
 - `PAYMENT_DELAY`: Payment delay in days for issued invoices ( default is 30 days which is the default in french law)
 - `MEMBER_CAN_EDIT_PROFILE`: Allow members to edit their profiles
 - `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
+- `DEBUG` : Enable debug for development **do not use in production** : display
+   stracktraces and enable [django-debug-toolbar](https://django-debug-toolbar.readthedocs.io).
 
 Accounting logs
 ---------------

+ 1 - 0
coin/billing/__init__.py

@@ -0,0 +1 @@
+default_app_config = 'coin.billing.app.BillingConfig'

+ 3 - 1
coin/billing/admin.py

@@ -104,9 +104,11 @@ class PaymentInlineAdd(admin.StackedInline):
 
 
 class InvoiceAdmin(admin.ModelAdmin):
+    list_display_links = ('number', 'date')
+    list_filter = ('status', 'validated', 'date')
+    search_fields = ['member__username', 'member__first_name', 'member__last_name', 'member__email', 'member__nickname', 'number']
     list_display = ('number', 'date', 'status', 'amount', 'member',
                     'validated')
-    list_display_links = ('number', 'date')
     fields = (('number', 'date', 'status'),
               ('date_due'),
               ('member'),

+ 9 - 0
coin/billing/app.py

@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+from django.apps import AppConfig
+
+
+class BillingConfig(AppConfig):
+    name = 'coin.billing'
+    verbose_name = 'Facturation'

+ 3 - 0
coin/billing/templates/billing/invoice_pdf.html

@@ -204,6 +204,9 @@
     </tbody>
   </table>
   <p>
+	TVA non applicable - article 293 B du CGI
+  </p>
+  <p>
     Facture à payer avant le {{ invoice.date_due }}.
   </p>
 

+ 0 - 2
coin/billing/urls.py

@@ -10,6 +10,4 @@ urlpatterns = patterns(
     url(r'^invoice/(?P<id>.+)/pdf$', views.invoice_pdf, name="invoice_pdf"),
     url(r'^invoice/(?P<id>.+)$', views.invoice, name="invoice"),
     # url(r'^invoice/(?P<id>.+)/validate$', views.invoice_validate, name="invoice_validate"),
-
-    url('invoice/create_all_members_invoices_for_a_period', views.gen_invoices)
 )

+ 2 - 9
coin/billing/views.py

@@ -3,7 +3,7 @@ from __future__ import unicode_literals
 
 from django.http import HttpResponse, HttpResponseRedirect
 from django.template import RequestContext
-from django.shortcuts import render, render_to_response
+from django.shortcuts import render
 from django.contrib import messages
 
 from sendfile import sendfile
@@ -11,15 +11,9 @@ from sendfile import sendfile
 from coin.billing.models import Invoice
 from coin.members.models import Member
 from coin.html2pdf import render_as_pdf
-from coin.billing.create_subscriptions_invoices import create_all_members_invoices_for_a_period
 from coin.billing.utils import get_invoice_from_id_or_number, assert_user_can_view_the_invoice
 
 
-def gen_invoices(request):
-    create_all_members_invoices_for_a_period()
-    return HttpResponse('blop')
-
-
 def invoice_pdf(request, id):
     """
     Renvoi une facture générée en format pdf
@@ -44,7 +38,6 @@ def invoice(request, id):
 
     assert_user_can_view_the_invoice(request, invoice)
 
-    return render_to_response('billing/invoice.html', {"invoice": invoice},
-                              context_instance=RequestContext(request))
+    return render(request, 'billing/invoice.html', {"invoice": invoice})
 
     return response

+ 2 - 0
coin/configuration/forms.py

@@ -3,12 +3,14 @@ from __future__ import unicode_literals
 
 from django.forms import ModelForm, ValidationError
 from django.db.models import Q
+from django import forms
 
 from coin.offers.models import OfferSubscription
 from coin.configuration.models import Configuration
 
 
 class ConfigurationForm(ModelForm):
+    comment = forms.CharField(widget=forms.Textarea)
 
     class Meta:
         model = Configuration

+ 1 - 0
coin/isp_database/__init__.py

@@ -0,0 +1 @@
+default_app_config = 'coin.isp_database.app.ISPdatabaseConfig'

+ 9 - 0
coin/isp_database/app.py

@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+from django.apps import AppConfig
+
+
+class ISPdatabaseConfig(AppConfig):
+    name = 'coin.isp_database'
+    verbose_name = 'Identité du FAI'

+ 1 - 0
coin/members/__init__.py

@@ -0,0 +1 @@
+default_app_config = 'coin.members.app.MembersConfig'

+ 8 - 0
coin/members/app.py

@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+from django.apps import AppConfig
+
+class MembersConfig(AppConfig):
+    name = 'coin.members'
+    verbose_name = 'Membres'

+ 41 - 1
coin/members/forms.py

@@ -4,9 +4,49 @@ from __future__ import unicode_literals
 from django import forms
 from django.contrib.auth.forms import PasswordResetForm, ReadOnlyPasswordHashField
 from django.forms.utils import ErrorList
+from django.forms.forms import BoundField
 
 from coin.members.models import Member
 
+from registration.forms import RegistrationForm
+
+
+class MemberRegistrationForm(RegistrationForm):
+    # Protect against robot
+    trap = forms.CharField(required=False, label='Trap',
+            widget=forms.TextInput(attrs={'style' : 'display:none'}),
+        help_text="Si vous êtes humain ignorez ce champ")
+
+    def __init__(self, *args, **kwargs):
+        super(MemberRegistrationForm, self).__init__(*args, **kwargs)
+
+        for fieldname in ['email', 'organization_name', 'password2']:
+            self.fields[fieldname].help_text = None
+
+    def is_valid(self):
+         valid = super(MemberRegistrationForm,self).is_valid()
+         avoid_trap = not self.data['trap']
+         if valid and avoid_trap:
+             return True
+         else:
+             return False
+
+    def as_p(self):
+        """"
+        We rewrite the as_p method to apply a style on the <p> tag related to
+        trap field. Indeed, it seeems there is no cleaner way to do it.
+        """
+        def css_classes(self, extra_classes=None):
+            return 'captcha'
+
+        func_type = type(BoundField.css_classes)
+        self['trap'].css_classes = func_type(css_classes, self, BoundField)
+        return super(MemberRegistrationForm, self).as_p()
+
+    class Meta:
+        model = Member
+        fields = ['type', 'first_name', 'last_name',
+                  'organization_name', 'email', 'username', 'trap']
 
 class MemberCreationForm(forms.ModelForm):
 
@@ -106,7 +146,7 @@ class OrganizationMemberChangeForm(AbstractMemberChangeForm):
                   'address', 'postal_code', 'city', 'country']
 
     def __init__(self, *args, **kwargs):
-        super(OrganizationChangeForm, self).__init__(*args, **kwargs)
+        super(OrganizationMemberChangeForm, self).__init__(*args, **kwargs)
         self.error_class = SpanError
         for fieldname in self.fields:
             self.fields[fieldname].help_text = None

+ 4 - 5
coin/members/management/commands/call_for_membership_fees.py

@@ -30,11 +30,10 @@ class Command(BaseCommand):
             raise CommandError(
                 'Please enter a valid date : YYYY-mm-dd (ex: 2011-07-04)')
 
-        end_dates = [date + relativedelta(months=-3),
-                     date + relativedelta(months=-2),
-                     date + relativedelta(months=-1),
-                     date,
-                     date + relativedelta(months=+1)]
+        end_dates = [
+            date + relativedelta(**params)
+            for params in settings.MEMBERSHIP_FEE_REMINDER_DATES
+        ]
 
         if verbosity >= 2:
             self.stdout.write("Selecting members whose membership fee end at "

+ 1 - 1
coin/members/migrations/0003_auto_20141007_0956.py

@@ -14,7 +14,7 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='membershipfee',
             name='amount',
-            field=models.IntegerField(default=settings.MEMBER_DEFAULT_COTISATION, help_text='en \u20ac', verbose_name='montant'),
+            field=models.IntegerField(default=settings.DEFAULT_MEMBERSHIP_FEE, help_text='en \u20ac', verbose_name='montant'),
         ),
         migrations.AlterField(
             model_name='membershipfee',

+ 1 - 1
coin/members/migrations/0004_auto_20141007_1002.py

@@ -15,6 +15,6 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='membershipfee',
             name='amount',
-            field=models.DecimalField(default=settings.MEMBER_DEFAULT_COTISATION, help_text='en \u20ac', verbose_name='montant', max_digits=5, decimal_places=2),
+            field=models.DecimalField(default=settings.DEFAULT_MEMBERSHIP_FEE, help_text='en \u20ac', verbose_name='montant', max_digits=5, decimal_places=2),
         ),
     ]

+ 17 - 4
coin/members/models.py

@@ -45,10 +45,15 @@ class Member(CoinLdapSyncMixin, AbstractUser):
         ('natural_person', 'Personne physique'),
         ('legal_entity', 'Personne morale'),
     )
+
+    MEMBER_STATUS_MEMBER = 'member'
+    MEMBER_STATUS_NOT_MEMBER = 'not_member'
+    MEMBER_STATUS_PENDING = 'pending'
+
     MEMBER_STATUS_CHOICES = (
-        ('member', 'Adhérent'),
-        ('not_member', 'Non adhérent'),
-        ('pending', "Demande d'adhésion"),
+        (MEMBER_STATUS_MEMBER, 'Adhérent'),
+        (MEMBER_STATUS_NOT_MEMBER, 'Non adhérent'),
+        (MEMBER_STATUS_PENDING, "Demande d'adhésion"),
     )
 
     status = models.CharField(max_length=50, choices=MEMBER_STATUS_CHOICES,
@@ -430,7 +435,7 @@ class MembershipFee(models.Model):
     member = models.ForeignKey('Member', related_name='membership_fees',
                                verbose_name='membre')
     amount = models.DecimalField(null=False, max_digits=5, decimal_places=2,
-                                 default=settings.MEMBER_DEFAULT_COTISATION,
+                                 default=settings.DEFAULT_MEMBERSHIP_FEE,
                                  verbose_name='montant', help_text='en €')
     start_date = models.DateField(
         null=False,
@@ -456,6 +461,14 @@ class MembershipFee(models.Model):
         if self.start_date is not None and self.end_date is None:
             self.end_date = self.start_date + datetime.timedelta(364)
 
+    def save(self, *args, **kwargs):
+        ret = super(MembershipFee, self).save(*args, **kwargs)
+        today = datetime.date.today()
+        if self.start_date <= today and today <= self.end_date:
+            self.member.status = self.member.MEMBER_STATUS_MEMBER
+            self.member.save()
+        return ret
+
     def __unicode__(self):
         return '%s - %s - %i€' % (self.member, self.start_date, self.amount)
 

+ 21 - 0
coin/members/registration_views.py

@@ -0,0 +1,21 @@
+from registration.backends.hmac.views import ActivationView, RegistrationView
+
+
+class MemberActivationView(ActivationView):
+    template_name = 'members/registration/activate.html'
+    def get_success_url(self, user):
+        return ('members:registration_activation_complete', (), {})
+
+class MemberRegistrationView(RegistrationView):
+    success_url = ('member:registration_activation_complete', (), {})
+    email_subject_template = 'members/registration/activation_email_subject.txt'
+    email_body_template = 'members/registration/activation_email.txt'
+    template_name = 'members/registration/registration_form.html'
+
+    def register(self, form):
+        new_user = super(MemberRegistrationView, self).register(form)
+        new_user.status = new_user.MEMBER_STATUS_PENDING
+        return new_user.save()
+
+    def get_success_url(self, user):
+        return ('members:registration_complete', (), {})

+ 8 - 0
coin/members/templates/members/registration/activate.html

@@ -0,0 +1,8 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+
+<p>L'activation de votre compte a échoué ou ce dernier a déjà été activé.</p>
+
+{% endblock %}

+ 18 - 0
coin/members/templates/members/registration/activation_complete.html

@@ -0,0 +1,18 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+
+<h2>Compte adhérent créé</h2>
+{% if dues %}
+    <p>Votre compte adhérent est désormais créé, pour finaliser votre adhésion merci d'<b>envoyer votre adhésion de {{ dues }} €</b> par virement  avec le libellé suivant:&nbsp;<b>{{ bank_transfer_label }}</b> .</p>
+
+    <h2>Coordonnées bancaires</h2>
+    <div id="payment-howto" class="panel">
+        {% include "billing/payment_howto.html" %}
+    </div>
+{% else %}
+    <p>Votre compte adhérent est désormais créé.</p>
+{% endif %}
+
+{% endblock %}

+ 12 - 0
coin/members/templates/members/registration/activation_email.txt

@@ -0,0 +1,12 @@
+{% load i18n %}
+Bonjour,
+
+Pour activer votre compte adhérent {{ site.name }}, merci de suivre le lien suivant:
+
+http://{{ site.domain }}{% url 'members:registration_activate' activation_key %}
+
+{% blocktrans %}Ce lien sera valable pendant {{ expiration_days }} jours.{% endblocktrans %}
+
+Ceci est un courriel automatique envoyé à la suite d'une demande de création de compte.
+
+L'équipe de l'association {{ branding.shortname|capfirst }}

+ 1 - 0
coin/members/templates/members/registration/activation_email_subject.txt

@@ -0,0 +1 @@
+{% load i18n %}Activation de votre compte adhérent {{ site.name }}

+ 11 - 4
coin/members/templates/members/registration/login.html

@@ -39,14 +39,21 @@
             <input type="submit" value="Connexion" class="button radius"/>
             <input type="hidden" name="next" value="{{ next }}" />
             <a id="password-reset-link" href="{% url 'members:password_reset' %}" tabindex="100">Mot de passe oublié ?</a>
+            {% if settings.REGISTRATION_OPEN  %}
+                / <a href="{% url 'members:registration_register' %}">Créer un compte</a>
+            {% endif %}
         </form>
     </div>
     <div class="medium-5 columns">
         <div class="panel callout" id="newcomers">
-            <h3>Nouvel adhérent ?</h3>
-            <p>Pour votre première connexion, il faut définir votre mot de passe.<br />
-            <a href="{% url 'members:password_reset' %}"><i class="fa fa-arrow-right"></i>
- Initialiser mon mot de passe</a></p>
+                {% if not settings.REGISTRATION_OPEN  %}
+                    <h3>Nouvel adhérent⋅e ?</h3>
+                    <p>Pour votre première connexion, il faut définir votre mot de passe.<br />
+                {% else %}
+                    <h3>Première connexion</h3>
+                    <p>Si un·e bénévole a déjà créé votre compte, il faut commencer par choisir votre mot de passe.<br />
+                {% endif %}
+                <a href="{% url 'members:password_reset' %}"><i class="fa fa-arrow-right"></i> Initialiser mon mot de passe</a></p>
         </div>
     </div>
 

+ 6 - 0
coin/members/templates/members/registration/registration_closed.html

@@ -0,0 +1,6 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+	<p>{% trans "Registration is currently closed." %}</p>
+{% endblock %}

+ 6 - 0
coin/members/templates/members/registration/registration_complete.html

@@ -0,0 +1,6 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+<p>Votre demande de création de compte a été enregistrée. Afin de finaliser la création du compte, un email d'activation vous a été envoyé.</p>
+{% endblock %}

+ 65 - 0
coin/members/templates/members/registration/registration_form.html

@@ -0,0 +1,65 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+        <h2>Créer un compte adhérent</h2>
+<div class="row">
+    <div class="medium-4 large-4 columns">
+        <div class="panel callout">
+            <h3>Déjà un compte ?</h3>
+            <p>Il est possible qu'un bénévole ait déjà créé votre compte.</p><p>Dans ce cas pour votre première connexion, il faut commencer par choisir votre mot de passe.<br />
+            <a href="{% url 'members:password_reset' %}"><i class="fa fa-arrow-right"></i> Initialiser mon mot de passe</a></p>
+        
+        <a href="{% url 'members:login' %}"><i class="fa fa-arrow-right"></i> OU essayer de me connecter</a>
+        </div>
+    </div>
+
+    <div class="medium-8 large-8 columns">
+        <form method="post" action=".">
+        
+            {% csrf_token %}
+            <fieldset class="module aligned wide">
+            {{ form.as_p }}
+            </fieldset>
+        <input type="submit" class="button radius" value="Créer mon compte" />
+        </form>
+    </div>
+</div>
+{% endblock %}
+{% block extra_js %}
+<script>
+$(document).ready(function () {
+  var hideFields=function(){
+    var optionSelected = $("option:selected", this);
+    var valueSelected = this.value;
+    if (valueSelected == 'legal_entity') {
+      $('#id_first_name').parent().hide();
+      $('#id_last_name').parent().hide();
+      $('#id_organization_name').parent().show();
+      $('#id_first_name').val('');
+      $('#id_last_name').val('');
+    } else if (valueSelected == 'natural_person') {
+      $('#id_organization_name').parent().hide();
+      $('#id_first_name').parent().show();
+      $('#id_last_name').parent().show();
+      $('#id_organization_name').val('');
+    }
+    return false;
+  };
+  $('#id_type').on('change', hideFields);
+  if (!$('#id_organization_name').val()) {
+    $('#id_type').val('natural_person');
+      $('#id_organization_name').parent().hide();
+      $('#id_first_name').parent().show();
+      $('#id_last_name').parent().show();
+  }
+  else {
+    $('#id_type').val('legal_entity');
+      $('#id_first_name').parent().hide();
+      $('#id_last_name').parent().hide();
+      $('#id_organization_name').parent().show();
+  }
+});
+</script>
+
+{% endblock %}

+ 18 - 3
coin/members/tests.py

@@ -2,17 +2,17 @@
 from __future__ import unicode_literals
 
 import os
-import logging
+
 import ldapdb
 from datetime import date
 from cStringIO import StringIO
 from dateutil.relativedelta import relativedelta
+from freezegun import freeze_time
 import unittest
 
 from django import db
 from django.conf import settings
-from django.test import TestCase, Client, override_settings
-from django.contrib.auth.models import User
+from django.test import TestCase, Client
 from django.core import mail, management
 from django.core.exceptions import ValidationError
 
@@ -359,6 +359,21 @@ class MemberTests(TestCase):
         # de cotisation
         self.assertEqual(member.is_paid_up(), True)
 
+    @freeze_time('2016-01-01')
+    def test_adding_running_fee_set_membership_status(self):
+        member = Member.objects.create(
+            first_name='a', last_name='b', username='c',
+            status=Member.MEMBER_STATUS_PENDING)
+
+        # Créé une cotisation passée
+        MembershipFee.objects.create(
+            member=member, amount=20,
+            start_date=date(2015, 12, 12),
+            end_date=date(2016, 12, 12))
+
+        member = Member.objects.get(pk=member.pk)
+        self.assertEqual(member.status, member.MEMBER_STATUS_MEMBER)
+
     def test_member_cant_be_created_without_names(self):
         """
         Test qu'un membre ne peut pas être créé sans "noms"

+ 44 - 3
coin/members/urls.py

@@ -2,16 +2,29 @@
 from __future__ import unicode_literals
 
 from django.conf.urls import patterns, url
-from django.views.generic import DetailView
+from coin.members import forms
 from coin.members import views
-from coin.members.models import Member
+from django.views.generic.base import TemplateView
+from . import registration_views as views_r
+from coin import settings
 
+from registration.signals import user_activated
+from django.contrib.auth import login
+
+def login_on_activation(sender, user, request, **kwargs):
+    """Logs in the user after activation"""
+    user.backend = 'django.contrib.auth.backends.ModelBackend'
+    login(request, user)
+
+# Registers the function with the django-registration user_activated signal
+user_activated.connect(login_on_activation)
 
 urlpatterns = patterns(
     '',
     url(r'^$', views.index, name='index'),
     url(r'^login/$', 'django.contrib.auth.views.login',
-        {'template_name': 'members/registration/login.html'},
+        {'template_name': 'members/registration/login.html',
+         'extra_context': {'settings': settings} },
         name='login'),
     url(r'^logout/$', 'django.contrib.auth.views.logout_then_login',
         name='logout'),
@@ -43,6 +56,34 @@ urlpatterns = patterns(
         name='password_reset_complete'),
 
 
+    url(r'^activate/complete/$', views.activation_completed,
+        name='registration_activation_complete'),
+    # The activation key can make use of any character from the
+    # URL-safe base64 alphabet, plus the colon as a separator.
+    url(r'^activate/(?P<activation_key>[-:\w]+)/$',
+        views_r.MemberActivationView.as_view(),
+        name='registration_activate'),
+    url(r'^register/$',
+        views_r.MemberRegistrationView.as_view(
+            form_class=forms.MemberRegistrationForm,
+            template_name='members/registration/registration_form.html'
+        ),
+        name='registration_register'),
+    url(r'^register/complete/$',
+        TemplateView.as_view(
+            template_name='members/registration/registration_complete.html'
+        ),
+        name='registration_complete'),
+    url(r'^register/closed/$',
+        TemplateView.as_view(
+            template_name='members/registration/registration_closed.html'
+        ),
+        name='registration_disallowed'),
+    #url(r'', include('registration.auth_urls')),
+
+
+
+
     url(r'^detail/$', views.detail,
         name='detail'),
 

+ 24 - 17
coin/members/views.py

@@ -2,18 +2,16 @@
 from __future__ import unicode_literals
 
 from django.template import RequestContext
-from django.shortcuts import render_to_response, render
+from django.shortcuts import render
 from django.contrib.auth.decorators import login_required
-from django.http import Http404
 from django.conf import settings
 from forms import PersonMemberChangeForm, OrganizationMemberChangeForm
 
 @login_required
 def index(request):
     has_isp_feed = 'isp' in [k for k, _, _ in settings.FEEDS]
-    return render_to_response('members/index.html',
-                              {'has_isp_feed': has_isp_feed},
-                              context_instance=RequestContext(request))
+    return render(request, 'members/index.html',
+                  {'has_isp_feed': has_isp_feed})
 
 
 @login_required
@@ -47,10 +45,9 @@ def subscriptions(request):
     subscriptions = request.user.get_active_subscriptions()
     old_subscriptions = request.user.get_inactive_subscriptions()
 
-    return render_to_response('members/subscriptions.html',
-                              {'subscriptions': subscriptions,
-                               'old_subscriptions': old_subscriptions},
-                              context_instance=RequestContext(request))
+    return render(request, 'members/subscriptions.html',
+                  {'subscriptions': subscriptions,
+                   'old_subscriptions': old_subscriptions})
 
 
 @login_required
@@ -59,15 +56,25 @@ def invoices(request):
     invoices = request.user.invoices.filter(validated=True).order_by('-date')
     payments = request.user.payments.filter().order_by('-date')
 
-    return render_to_response('members/invoices.html',
-                              {'balance' : balance, 
-                               'handle_balance' : settings.HANDLE_BALANCE, 
-                               'invoices': invoices, 
-                               'payments': payments},
-                              context_instance=RequestContext(request))
+    return render(request, 'members/invoices.html',
+                              {'balance' : balance,
+                               'handle_balance' : settings.HANDLE_BALANCE,
+                               'invoices': invoices,
+                               'payments': payments})
 
 
 @login_required
 def contact(request):
-    return render_to_response('members/contact.html',
-                              context_instance=RequestContext(request))
+    return render(request, 'members/contact.html')
+
+
+@login_required
+def activation_completed(request):
+    label_template = settings.MEMBERSHIP_REFERENCE.format(user=request.user)
+    context = {
+        'bank_transfer_label': label_template,
+        'dues': settings.DEFAULT_MEMBERSHIP_FEE
+    }
+
+    return render(request, 'members/registration/activation_complete.html',
+                  context)

+ 2 - 0
coin/mixins.py

@@ -4,6 +4,8 @@ from __future__ import unicode_literals
 from django.db import transaction
 from django.conf import settings
 
+from django.views.generic import TemplateView
+
 
 class CoinLdapSyncMixin(object):
 

+ 1 - 0
coin/offers/__init__.py

@@ -0,0 +1 @@
+default_app_config = 'coin.offers.app.OffersConfig'

+ 9 - 0
coin/offers/app.py

@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+from django.apps import AppConfig
+
+
+class OffersConfig(AppConfig):
+    name = 'coin.offers'
+    verbose_name = 'Offres et Abonnements'

+ 37 - 1
coin/settings_base.py

@@ -118,6 +118,7 @@ TEMPLATE_LOADERS = (
 )
 
 MIDDLEWARE_CLASSES = (
+    'debug_toolbar.middleware.DebugToolbarMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
@@ -127,6 +128,14 @@ MIDDLEWARE_CLASSES = (
     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 )
 
+# Do not load jQuery from crappy CDN
+DEBUG_TOOLBAR_CONFIG = {
+    'JQUERY_URL': '/static/js/vendor/jquery.js'
+}
+
+# Used for debug toolbar
+INTERNAL_IPS = ['127.0.0.1', '::1']
+
 ROOT_URLCONF = 'coin.urls'
 
 # Python dotted path to the WSGI application used by Django's runserver.
@@ -140,6 +149,7 @@ TEMPLATE_DIRS = (
 EXTRA_TEMPLATE_DIRS = tuple()
 
 INSTALLED_APPS = (
+    'debug_toolbar',  # always installed, but enabled only if DEBUG=True
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
@@ -244,18 +254,37 @@ LDAP_ACTIVATE = False
 LDAP_USER_BASE_DN = None
 VPN_CONF_BASE_DN = None
 
+# Allow member to edit their vpn
+MEMBER_CAN_EDIT_VPN_CONF = True
+
 # Membership configuration
 # Default cotisation in €, per year
-MEMBER_DEFAULT_COTISATION = 20
+DEFAULT_MEMBERSHIP_FEE = 20
 
 # Link to a page with information on how to become a member or pay the
 # membership fee
 MEMBER_MEMBERSHIP_INFO_URL = ''
 
+
+# When should we remind a member about its membership ?  List of deltas from
+# the anniversary date, can be a combination of positive (after anniversary)
+# and negative (before aniversary) af months, days and weeks.
+MEMBERSHIP_FEE_REMINDER_DATES = [
+    {'months': -3},  # 3 months before
+    {'months': -2},  # 2 months before
+    {'months': -1},  # 1 month before
+    {'days': 0},     # the day of anniversary
+    {'months': +1},  # 1 month after
+]
+
 # Pattern used to display a unique reference for any subscription
 # Helpful for bank wire transfer identification
 SUBSCRIPTION_REFERENCE = 'REF-{subscription.offer.reference}-{subscription.pk}'
 
+# Template string to display the label the member should indicates for the bank
+# transfer
+MEMBERSHIP_REFERENCE = "ADH-{user.pk}"
+
 # Payment delay in days
 PAYMENT_DELAY = 30
 
@@ -270,6 +299,13 @@ FEEDS = (
 #    ('isp', 'http://isp.example.com/feed/', 3),
 )
 
+# Account registration
+# Allow visitor to join the association by register on COIN
+REGISTRATION_OPEN = False
+
+# All account with unvalidated email will be deleted after X days
+ACCOUNT_ACTIVATION_DAYS = 7
+
 # Member can edit their own data
 MEMBER_CAN_EDIT_PROFILE = False
 

+ 5 - 0
coin/static/css/local.css

@@ -420,3 +420,8 @@ form .helptext {
 .list-filter {
 	text-align: right;
 }
+
+/* Registration */
+.captcha {
+    display:none;
+}

+ 7 - 0
coin/urls.py

@@ -53,3 +53,10 @@ urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
 
 # Pluggable apps URLs
 urlpatterns += list(apps_urlpatterns())
+
+
+if settings.DEBUG:
+    import debug_toolbar
+    urlpatterns = [
+        url(r'^__debug__/', include(debug_toolbar.urls)),
+    ] + urlpatterns

+ 3 - 4
coin/views.py

@@ -6,7 +6,7 @@ import HTMLParser
 
 from django.views.decorators.cache import cache_page
 from django.template import RequestContext
-from django.shortcuts import render_to_response
+from django.shortcuts import render
 from django.http import HttpResponse, HttpResponseNotFound, HttpResponseServerError
 from django.conf import settings
 
@@ -36,8 +36,7 @@ def feed(request, feed_name):
         feed = feedparser.parse(feed_url)
         entries = feed.entries[:limit]
 
-        return render_to_response('fragments/feed.html',
-                                  {'feed_entries': entries},
-                                  context_instance=RequestContext(request))
+        return render(request, 'fragments/feed.html',
+                                  {'feed_entries': entries})
     except:
         return HttpResponseServerError('')

+ 1 - 1
contrib/ansible/coin-customizations/django_local_settings.py.j2

@@ -27,7 +27,7 @@ STATIC_ROOT = '{{ www_static_assets_directory }}'
 #EMAIL_USE_TLS = True
 #EMAIL_HOST = "localhost"
 
-MEMBER_DEFAULT_COTISATION = 16
+DEFAULT_MEMBERSHIP_FEE = 16
 
 FEEDS = (
           #('isp', 'https://faimaison.net/feeds/all.atom.xml', 3),

BIN
doc/_img/user-subscriptions.png


+ 2 - 0
requirements.txt

@@ -16,5 +16,7 @@ feedparser
 six==1.10.0
 WeasyPrint==0.31
 freezegun==0.3.8
+django-registration==2.2
 pytz>=2018.5
 unidecode>=1.0,<1.1
+django-debug-toolbar>=1.9.1,<1.10

+ 1 - 0
simple_dsl/__init__.py

@@ -0,0 +1 @@
+default_app_config = 'simple_dsl.app.SimpleDSLConfig'

+ 9 - 0
simple_dsl/app.py

@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+from django.apps import AppConfig
+
+
+class SimpleDSLConfig(AppConfig):
+    name = 'simple_dsl'
+    verbose_name = 'xDSl'

+ 2 - 3
simple_dsl/models.py

@@ -14,9 +14,8 @@ class SimpleDSL(Configuration):
     DSL reselling.
     """
     class Meta:
-        verbose_name = 'DSL line'
-        # If Django's default pluralisation is not satisfactory
-        #verbose_name_plural = 'very many DSL lines'
+        verbose_name = 'ligne xDSL'
+        verbose_name_plural = 'lignes xDSL'
 
     # URL namespace associated to this configuration type, to build URLs
     # in various view.  Should also be defined in urls.py.  Here, we don't

+ 1 - 1
vpn/apps.py

@@ -9,6 +9,6 @@ from . import urls
 
 class VPNConfig(AppConfig, coin.apps.AppURLs):
     name = 'vpn'
-    verbose_name = "Gestion d'accès VPN"
+    verbose_name = "Tunnels VPN"
 
     exported_urlpatterns = [('vpn', urls.urlpatterns)]

+ 19 - 0
vpn/migrations/0002_vpnconfiguration_crypto_link.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('vpn', '0001_squashed_0002_remove_vpnconfiguration_comment'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='vpnconfiguration',
+            name='crypto_link',
+            field=models.URLField(help_text='Lien \xe0 usage unique (d\xe9truit apr\xe8s ouverture)', null=True, verbose_name='Mat\xe9riel cryptographique', blank=True),
+        ),
+    ]

+ 2 - 2
vpn/models.py

@@ -10,7 +10,6 @@ import ldapdb.models
 from ldapdb.models.fields import CharField, ListField
 
 from coin.mixins import CoinLdapSyncMixin
-from coin.offers.models import OfferSubscription
 from coin.configuration.models import Configuration
 # from coin.offers.backends import ValidateBackendType
 from coin import utils
@@ -38,7 +37,8 @@ class VPNConfiguration(CoinLdapSyncMixin, Configuration):
                                      verbose_name="IPv6", blank=True, null=True,
                                      help_text="Adresse IPv6 utilisée par "
                                      "défaut sur le VPN")
-
+    crypto_link = models.URLField(verbose_name="Matériel cryptographique", blank=True,
+                           null=True, help_text="Lien à usage unique (détruit après ouverture)")
     objects = NetManager()
 
     def get_absolute_url(self):

+ 56 - 24
vpn/templates/vpn/vpn.html

@@ -5,43 +5,62 @@
 {% block content %}
 <div class="row">
     <h2>Configuration du VPN</h2>
-    <form class="flatform" action="{{ object.get_absolute_url }}" method="post">{% csrf_token %}
-    <p class="legend">Quand vous aurez terminé vos modifications, cliquez sur <input class="button" type="submit" value="Valider" /></p>
-
+    {% if form %}
+        <form class="flatform" action="{{ object.get_absolute_url }}" method="post">{% csrf_token %}
+        <p class="legend">Quand vous aurez terminé vos modifications, cliquez sur <input class="button" type="submit" value="Valider" /></p>
+    {% endif %}
     {% for message in messages %}
-    <div class="message eat-up{% if message.tags %} {{ message.tags }}{% endif %}">
-        {{ message }}
-    </div>
+        <div class="message eat-up{% if message.tags %} {{ message.tags }}{% endif %}">
+            {{ message }}
+        </div>
     {% endfor %}
 
-    {% if form.non_field_errors or form.ipv4_endpoint.errors or form.ipv6_endpoint.errors %}
-    <div class="alert-box alert nogap">
-      {{ form.non_field_errors }}
-      {{ form.ipv4_endpoint.errors }}
-      {{ form.ipv6_endpoint.errors }}
-    </div>{% endif %}
-
+    {% if form %}
+        {% if form.non_field_errors or form.ipv4_endpoint.errors or form.ipv6_endpoint.errors %}
+            <div class="alert-box alert nogap">
+            {{ form.non_field_errors }}
+            {{ form.ipv4_endpoint.errors }}
+            {{ form.ipv6_endpoint.errors }}
+            </div>
+        {% endif %}
+    {% endif %}
     <div class="large-6 columns">
         <div class="panel">
-            <h3>Statut</h3>
+            <h3>Authentification</h3>
             <table class="full-width">
                 <tr>
                     <td class="center"><span class="label">Identifiant</span></td>
                     <td>{{object.login}}</td>
                 </tr>
+                {% if object.password %}
                 <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>
                     </td>
                 </tr>
+                {% endif %}
+                {% if object.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>
+                </tr>
+                {% endif %}
                 <tr class="flatfield">
-                    <td class="center">{{ form.comment.label_tag }}</td>
-                    <td>{{ form.comment }}</td>
+                    {% if form %}
+                        <td class="center">{{ form.comment.label_tag }}</td>
+                        <td>{{ form.comment }}</td>
+                    {% else %}
+                    <td class="center"><span class="label">Commentaire</span></td>
+                        <td>{{ object.comment }}</td>
+                        
+                    {% endif %}
                 </tr>
                 <tr>
                     <td class="center boolviewer" colspan="2">
+                    {% if form %}
                         <input type="checkbox" disabled="disabled"{% if object.activated %} checked="checked"{% endif %} />
+                    {% endif %}
                         <span>Ce VPN est {{ object.activated|yesno:"activé,désactivé" }}</span>
                     </td>
                 </tr>
@@ -53,14 +72,25 @@
         <div class="panel">
             <h3>Adresses IP</h3>
             <table class="full-width">
-                <tr class="flatfield">
-                    <td class="center">{{ form.ipv4_endpoint.label_tag }}</td>
-                    <td{% if form.non_field_errors or form.ipv4_endpoint.errors %} class="errored"{% endif %}>{{ form.ipv4_endpoint }}</td>
-                </tr>
-                <tr class="flatfield">
-                    <td class="center">{{ form.ipv6_endpoint.label_tag }}</td>
-                    <td{% if form.non_field_errors or form.ipv6_endpoint.errors %} class="errored"{% endif %}>{{ form.ipv6_endpoint }}</td>
-                </tr>
+                {% if form %}
+                    <tr class="flatfield">
+                        <td class="center">{{ form.ipv4_endpoint.label_tag }}</td>
+                        <td{% if form.non_field_errors or form.ipv4_endpoint.errors %} class="errored"{% endif %}>{{ form.ipv4_endpoint }}</td>
+                    </tr>
+                    <tr class="flatfield">
+                        <td class="center">{{ form.ipv6_endpoint.label_tag }}</td>
+                        <td{% if form.non_field_errors or form.ipv6_endpoint.errors %} class="errored"{% endif %}>{{ form.ipv6_endpoint }}</td>
+                    </tr>
+                {% else %}
+                    <tr class="flatfield">
+                        <td class="center"><span class="label">IPv4</span></td>
+                        <td>{{ object.ipv4_endpoint }}</td>
+                    </tr>
+                    <tr class="flatfield">
+                        <td class="center"><span class="label">IPv6</span></td>
+                        <td>{{ object.ipv6_endpoint }}</td>
+                    </tr>
+                {% endif %}
                 <tr>
                     <td class="center"><span class="label">Sous-réseaux</span></td>
                     <td>
@@ -70,8 +100,10 @@
             </table>
         </div>
     </div>
+    {% if form %}
     <p class="formcontrol"><input class="button" type="submit" value="Valider" /></p>
     </form>
+    {% endif %}
 </div>
 
 <div class="row" id="graph">

+ 7 - 1
vpn/views.py

@@ -5,8 +5,9 @@ import os
 import urllib2
 
 from django.http import StreamingHttpResponse, HttpResponseServerError
-from django.shortcuts import render_to_response, get_object_or_404
+from django.shortcuts import get_object_or_404
 from django.views.generic.detail import DetailView
+from django.shortcuts import get_object_or_404
 from django.views.generic.edit import UpdateView
 from django.conf import settings
 from django.contrib.messages.views import SuccessMessageMixin
@@ -27,6 +28,11 @@ class VPNView(SuccessMessageMixin, UpdateView):
     def dispatch(self, *args, **kwargs):
         return super(VPNView, self).dispatch(*args, **kwargs)
 
+    def get_form(self, form_class=None):
+        if settings.MEMBER_CAN_EDIT_VPN_CONF:
+            return super(VPNView, self).get_form(form_class)
+        return None
+
     def get_object(self):
         if self.request.user.is_superuser:
             return get_object_or_404(VPNConfiguration, pk=self.kwargs.get("pk"))