From 56c3d39b17b6fa5b3fc58f0e02f0f863e5917f05 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Wed, 28 Oct 2015 16:31:09 +0100 Subject: [PATCH 1/3] Add module auth_signup_verify_email. --- .travis.yml | 1 + auth_signup_verify_email/README.rst | 84 +++++++++ auth_signup_verify_email/__init__.py | 5 + auth_signup_verify_email/__openerp__.py | 25 +++ .../controllers/__init__.py | 5 + auth_signup_verify_email/controllers/main.py | 52 ++++++ .../static/description/icon.png | Bin 0 -> 10549 bytes .../static/description/icon.svg | 172 ++++++++++++++++++ auth_signup_verify_email/views/signup.xml | 20 ++ 9 files changed, 364 insertions(+) create mode 100644 auth_signup_verify_email/README.rst create mode 100644 auth_signup_verify_email/__init__.py create mode 100644 auth_signup_verify_email/__openerp__.py create mode 100644 auth_signup_verify_email/controllers/__init__.py create mode 100644 auth_signup_verify_email/controllers/main.py create mode 100644 auth_signup_verify_email/static/description/icon.png create mode 100644 auth_signup_verify_email/static/description/icon.svg create mode 100644 auth_signup_verify_email/views/signup.xml diff --git a/.travis.yml b/.travis.yml index b7bd84095..ca96d060f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ install: - travis_install_nightly - pip install python-ldap - pip install unidecode + - pip install validate_email - printf '[options]\n\nrunning_env = dev' > ${HOME}/.openerp_serverrc - ln -s server_environment_files_sample ./server_environment_files script: diff --git a/auth_signup_verify_email/README.rst b/auth_signup_verify_email/README.rst new file mode 100644 index 000000000..324821b31 --- /dev/null +++ b/auth_signup_verify_email/README.rst @@ -0,0 +1,84 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +====================== +Verify email at signup +====================== + +This module was written to extend the functionality of public sign up to force +users to provide a valid email address. + +To reinforce this requirement, the user will not need to provide a password at +sign up, but when logging in later for the first time. + +Installation +============ + +* Install validate_email_ with ``pip install validate_email`` or equivalent. + +Configuration +============= + +To configure this module, you need to: + +* `Properly configure your outgoing email server(s) + `_. +* Go to *Settings > Configuration > General Settings* and enable *Allow + external users to sign up*. + +Usage +===== + +To use this module, you need to: + +* Log out. +* `Sign up `_ with a valid email. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/186/8.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. + +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and +welcomed feedback `here `_. + + +Credits +======= + +Icon +---- + +* https://openclipart.org/detail/3040/thumbtack-note-email +* https://openclipart.org/detail/202732/check-mark + +Contributors +------------ + +* Rafael Blasco +* Jairo Llopis + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. + +.. _validate_email: https://pypi.python.org/pypi/validate_email diff --git a/auth_signup_verify_email/__init__.py b/auth_signup_verify_email/__init__.py new file mode 100644 index 000000000..35233d377 --- /dev/null +++ b/auth_signup_verify_email/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingeniería, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import controllers diff --git a/auth_signup_verify_email/__openerp__.py b/auth_signup_verify_email/__openerp__.py new file mode 100644 index 000000000..1b543fd40 --- /dev/null +++ b/auth_signup_verify_email/__openerp__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingeniería, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Verify email at signup", + "summary": "Force uninvited users to use a good email for signup", + "version": "8.0.1.0.0", + "category": "Authentication", + "website": "https://odoo-community.org/", + "author": "Antiun Ingeniería, S.L., Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "external_dependencies": { + "python": [ + "validate_email", + ], + }, + "depends": [ + "auth_signup", + ], + "data": [ + "views/signup.xml", + ], +} diff --git a/auth_signup_verify_email/controllers/__init__.py b/auth_signup_verify_email/controllers/__init__.py new file mode 100644 index 000000000..d10129bed --- /dev/null +++ b/auth_signup_verify_email/controllers/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingeniería, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import main diff --git a/auth_signup_verify_email/controllers/main.py b/auth_signup_verify_email/controllers/main.py new file mode 100644 index 000000000..137c275ee --- /dev/null +++ b/auth_signup_verify_email/controllers/main.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# © 2015 Antiun Ingeniería, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import logging +from openerp import _, http +from openerp.addons.auth_signup.controllers.main import AuthSignupHome + + +_logger = logging.getLogger(__name__) + + +class SignupVerifyEmail(AuthSignupHome): + @http.route() + def web_auth_signup(self, *args, **kw): + if (http.request.params.get("login") and + not http.request.params.get("password")): + return self.passwordless_signup(http.request.params) + else: + return super(SignupVerifyEmail, self).web_auth_signup(*args, **kw) + + def passwordless_signup(self, values): + qcontext = self.get_auth_signup_qcontext() + + # Check good format of e-mail + from validate_email import validate_email + if not validate_email(values.get("login", "")): + qcontext["error"] = _("That does not seem to be an email address.") + return http.request.render("auth_signup.signup", qcontext) + elif not values.get("email"): + values["email"] = values.get("login") + + # Remove password + values["password"] = False + sudo_users = (http.request.env["res.users"] + .with_context(create_user=True).sudo()) + + try: + sudo_users.signup(values, qcontext.get("token")) + sudo_users.reset_password(values.get("login")) + except Exception as error: + # Duplicate key or wrong SMTP settings, probably + _logger.exception(error) + http.request.env.cr.rollback() + + # Agnostic message for security + qcontext["error"] = _( + "Something went wrong, please try again later or contact us.") + return http.request.render("auth_signup.signup", qcontext) + + qcontext["message"] = _("Check your email to activate your account!") + return http.request.render("auth_signup.reset_password", qcontext) diff --git a/auth_signup_verify_email/static/description/icon.png b/auth_signup_verify_email/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..52e1b17dcb661d98f613efecf525de26b26fe8c6 GIT binary patch literal 10549 zcmV-5DazJ~P)`h+6;vAOJ~3 zK~#9!?VWjimDhRazvo@l7AX7dIZ3&vV`*xM?@-rrorg_I|aMD_6edYf=}#J?PIDH>dc`ZP$iJsapDp z0e|0l?gxghyI~*-B!y7%(D3i6t(%|c)`hp<1mt?{h4qhe+p>WHNL=_%1jqz3gb+C> zHBJaM4Ojp?u9SEnQt+MlV87q^W1jpqYk$TESKQa8jwG#6|!y9lgwT8kpX`nKmYwqUGwu$&RvvOSH1rMS=3U*rrf%If48uuh|Rfm9NoK>@l$U_DG>dP zvgyn}8R0-GUnn_D2r*PCMk2Tcm?%&afU?0{o8txU%qsfkvwt)zWMOj=oAc_rCw~Y~ z2$(?ga22b4H1AOV!S}*$sSCgkK;v^fiCeBT1HsAUwJa?b*=puTV{@Oj`XT~f2#rYh72G6*i+)bQu~ zGJSKbg@^=fgCg-+8-hSTehr2sW%v;8;nJ5MPE>o2M~PyGBA1=*uq`3 zORxLulyFxFL^!0SRXxxEj;|BLeF?}VW?1;=tMD5sB5DOO&|pL z{=n}O0*)SO@w;feIbN=uPC_`dA-b-FGHg-qHz6=%=3;94F+h(5F>gc_|NyZiao zf^kiNtl#i7OP72UA=2J3x^hO>m%qrymv)HRW1gRarm6*M1~3iWd?4KGacvP+2wW$Q z?RzMdp8P<*PU3YJ5rFU*1I;9ziFbh^9q^J8LkeP{;5AW}Qi{T&Y}Tzg$lrcr8M>|w zC>#PogOC9Y^>Lb-5)2s$M%o`x+@ukZU%fwIuPbosB28m-XiGvPKy-#q2juF$4 zuEOh(7%_nv)hW`m$r52KB&US~-c!K!1F~)NYUbXWmTPr~f3D?bT^uhodAmT(1ZIFYwClaykGDZzDt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VUIn9iQx%6k`3j@{V&rk((n|t)&g3_4Iu-~+VP-iw zdZxEX3&=Y%CUp!c_)L*IWZ9TlY--z&!zIb3eM=&J&20{zzqES9pIv&U_EN=zOE~zY zjqk{~-m@#Dcl~Jks<~q_r?svR7bZ*kJ2h31?s3Br^E9*6EHb=AHz z_p3V>?fmzu=V!6&_8sroxZbOI2sQU@pz>Gggs@|G?kW3xWS0g07jsS@xnfLBqzT;(p z#xCm8#k|tx>B{#-==Ca*8U-k<9)M20P25# z27qMkKAAh`mh)!5JywtT;|97%UZ6;w&ba6_hCaLJ!`m7ly=C;~3b}z+{y@5MwC~d| zopvsUe&IF;8v0))3a34QeKGXa=4VEn0;pO)tEVJ?6ObFIx~4rj4}e!@e|)XiZvNU! znEkE~>rC_)*17P86aTnMrj=FnUB7;v_n}>U>}=Qn*2}DElP-jcl9P-KucSM^r>QDh z=e3z%-hKOyb7`ttLd_R8zU$Yn@jkU~>N@bbO|M&L!wrYF4O zSBs}EX&JX~;h9P2X1y|f3c!8p=KQ=XHuvxp0ID|5{MxitbMMZc^hF(@{AWvVPR_d$ zPky?DncHUc$wn%EvH0f1+_al^({9>LyJ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2007-02-06T06:13:53 + Thumbtack note with message "E-mail!" + https://openclipart.org/detail/3040/thumbtack-note-email-by-zeimusu + + + zeimusu + + + + + bulletin + email + memo + note + thumbtack + thumbtack note + + + + + + + + + + + diff --git a/auth_signup_verify_email/views/signup.xml b/auth_signup_verify_email/views/signup.xml new file mode 100644 index 000000000..a0a13ae60 --- /dev/null +++ b/auth_signup_verify_email/views/signup.xml @@ -0,0 +1,20 @@ + + + + + + + + From bff359710e975218d8945a2f6e1862e80d33bb67 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Wed, 28 Oct 2015 16:51:59 +0100 Subject: [PATCH 2/3] Import module following guidelines. --- auth_signup_verify_email/controllers/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/auth_signup_verify_email/controllers/main.py b/auth_signup_verify_email/controllers/main.py index 137c275ee..01e0474b7 100644 --- a/auth_signup_verify_email/controllers/main.py +++ b/auth_signup_verify_email/controllers/main.py @@ -6,9 +6,13 @@ import logging from openerp import _, http from openerp.addons.auth_signup.controllers.main import AuthSignupHome - _logger = logging.getLogger(__name__) +try: + from validate_email import validate_email +except ImportError: + _logger.debug("Cannot import `validate_email`.") + class SignupVerifyEmail(AuthSignupHome): @http.route() @@ -23,7 +27,6 @@ class SignupVerifyEmail(AuthSignupHome): qcontext = self.get_auth_signup_qcontext() # Check good format of e-mail - from validate_email import validate_email if not validate_email(values.get("login", "")): qcontext["error"] = _("That does not seem to be an email address.") return http.request.render("auth_signup.signup", qcontext) From ee661628cb4c277a4e519db9045710ecc38f2894 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 30 Oct 2015 17:33:59 +0100 Subject: [PATCH 3/3] README typos. --- auth_signup_verify_email/README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/auth_signup_verify_email/README.rst b/auth_signup_verify_email/README.rst index 324821b31..8ab62eaaf 100644 --- a/auth_signup_verify_email/README.rst +++ b/auth_signup_verify_email/README.rst @@ -6,10 +6,10 @@ Verify email at signup ====================== -This module was written to extend the functionality of public sign up to force -users to provide a valid email address. +This module extends the functionality of public sign up, and forces users to +provide a valid email address. -To reinforce this requirement, the user will not need to provide a password at +To achieve this requirement, the user does not need to provide a password at sign up, but when logging in later for the first time. Installation @@ -37,7 +37,7 @@ To use this module, you need to: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/186/8.0 + :target: https://runbot.odoo-community.org/runbot/149/8.0 Bug Tracker ===========