From f2610b09b6acf978c5dea13ef33630eb33d15d00 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 17 Mar 2014 16:41:20 +0100 Subject: [PATCH 01/14] [ADD] new module 'auth_admin_passkey' that allow admin user (uid=1) to login with any login and his password. --- auth_admin_passkey/__init__.py | 6 ++ auth_admin_passkey/__openerp__.py | 63 ++++++++++++++++ .../data/ir_config_parameter.xml | 16 ++++ auth_admin_passkey/i18n/fr.po | 42 +++++++++++ auth_admin_passkey/model/__init__.py | 7 ++ auth_admin_passkey/model/res_config.py | 48 ++++++++++++ auth_admin_passkey/model/res_users.py | 71 ++++++++++++++++++ auth_admin_passkey/static/src/img/icon.png | Bin 0 -> 4113 bytes auth_admin_passkey/view/res_config_view.xml | 29 +++++++ 9 files changed, 282 insertions(+) create mode 100644 auth_admin_passkey/__init__.py create mode 100644 auth_admin_passkey/__openerp__.py create mode 100644 auth_admin_passkey/data/ir_config_parameter.xml create mode 100644 auth_admin_passkey/i18n/fr.po create mode 100644 auth_admin_passkey/model/__init__.py create mode 100644 auth_admin_passkey/model/res_config.py create mode 100644 auth_admin_passkey/model/res_users.py create mode 100644 auth_admin_passkey/static/src/img/icon.png create mode 100644 auth_admin_passkey/view/res_config_view.xml diff --git a/auth_admin_passkey/__init__.py b/auth_admin_passkey/__init__.py new file mode 100644 index 000000000..12135a333 --- /dev/null +++ b/auth_admin_passkey/__init__.py @@ -0,0 +1,6 @@ +# -*- encoding: utf-8 -*- +################################################################################ +# See __openerp__.py file for Copyright and Licence Informations. +################################################################################ + +import model diff --git a/auth_admin_passkey/__openerp__.py b/auth_admin_passkey/__openerp__.py new file mode 100644 index 000000000..dd9e30ac6 --- /dev/null +++ b/auth_admin_passkey/__openerp__.py @@ -0,0 +1,63 @@ +# -*- encoding: utf-8 -*- +################################################################################ +# See Copyright and Licence Informations undermentioned. +################################################################################ + +{ + 'name': 'Authentification - Admin Passkey', + 'version': '2.1', + 'category': 'base', + 'description': """ +Admin password become a passkey for all active logins +===================================================== + +Functionnalities : +------------------ + * Administrator has now the possibility to login in with any login; + * By default, OpenERP will send a mail to user and admin to indicate them; + +Technical informations : +------------------------ + * Create two ir_config_parameter to enable / disable mail sending; + +Limits : +-------- + * For the moment, this module doesn't manage translations for the mails; + * This module is compatible with 'auth_crypt' depending of the order of the installation: + * if 'auth_crypt' is first installed, it will work; + * if 'auth_admin_passkey' is first installed, it won't work; +If you want to install 'auth_crypt', please uninstall 'auth_admin_passkey' and +reinstall it after the installation of 'auth_crypt'. + +Otherwise, you can propose the merge of a glue module that manage this case. + +Copyright and Licence : +----------------------- + * 2014, Groupement Régional Alimentaire de Proximité + * Licence : AGPL-3 (http://www.gnu.org/licenses/) + +Contacts : +---------- + * Sylvain LE GAL (https://twitter.com/legalsylvain); + * for any help or question about this module. + """, + 'author': 'GRAP', + 'website': 'http://www.grap.coop', + 'license': 'AGPL-3', + 'depends': [ + 'mail', + ], + 'data': [ + 'data/ir_config_parameter.xml', + 'view/res_config_view.xml', + ], + 'demo': [], + 'js': [], + 'css': [], + 'qweb': [], + 'images': [], + 'post_load': '', + 'application': False, + 'installable': True, + 'auto_install': False, +} diff --git a/auth_admin_passkey/data/ir_config_parameter.xml b/auth_admin_passkey/data/ir_config_parameter.xml new file mode 100644 index 000000000..6cb75828c --- /dev/null +++ b/auth_admin_passkey/data/ir_config_parameter.xml @@ -0,0 +1,16 @@ + + + + + + auth_admin_passkey.send_to_admin + True + + + + auth_admin_passkey.send_to_user + True + + + + diff --git a/auth_admin_passkey/i18n/fr.po b/auth_admin_passkey/i18n/fr.po new file mode 100644 index 000000000..c352d40a5 --- /dev/null +++ b/auth_admin_passkey/i18n/fr.po @@ -0,0 +1,42 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * auth_admin_passkey +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-03-17 12:04+0000\n" +"PO-Revision-Date: 2014-03-17 12:04+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: auth_admin_passkey +#: view:base.config.settings:0 +msgid "Passkey" +msgstr "Mot de passe bris de glace" + +#. module: auth_admin_passkey +#: field:base.config.settings,auth_admin_passkey_send_to_admin:0 +msgid "Send email to admin user." +msgstr "Envoyer un email à l'administrateur." + +#. module: auth_admin_passkey +#: help:base.config.settings,auth_admin_passkey_send_to_user:0 +msgid "When the administrator use his password to login in with a different account, OpenERP will send an email to the account user." +msgstr "Quand l'administrateur utilise son mot de passe pour s'authentifier avec un compte différent, OpenERP lui enverra un mail." + +#. module: auth_admin_passkey +#: help:base.config.settings,auth_admin_passkey_send_to_admin:0 +msgid "When the administrator use his password to login in with a different account, OpenERP will send an email to the admin user." +msgstr "Quand l'administrateur utilise son mot de passe pour s'authentifier avec un compte différent, OpenERP enverra un mail à l'utilisateur." + +#. module: auth_admin_passkey +#: field:base.config.settings,auth_admin_passkey_send_to_user:0 +msgid "Send email to user." +msgstr "Envoyer un email à l'utilisateur." + diff --git a/auth_admin_passkey/model/__init__.py b/auth_admin_passkey/model/__init__.py new file mode 100644 index 000000000..c672ffa17 --- /dev/null +++ b/auth_admin_passkey/model/__init__.py @@ -0,0 +1,7 @@ +# -*- encoding: utf-8 -*- +################################################################################ +# See __openerp__.py file for Copyright and Licence Informations. +################################################################################ + +import res_config +import res_users diff --git a/auth_admin_passkey/model/res_config.py b/auth_admin_passkey/model/res_config.py new file mode 100644 index 000000000..53e5d99b9 --- /dev/null +++ b/auth_admin_passkey/model/res_config.py @@ -0,0 +1,48 @@ +# -*- encoding: utf-8 -*- +################################################################################ +# See __openerp__.py file for Copyright and Licence Informations. +################################################################################ + +from openerp.osv import fields +from openerp.osv.orm import TransientModel +from openerp.tools.safe_eval import safe_eval + +class base_config_settings(TransientModel): + _inherit = 'base.config.settings' + + ### Getter / Setter Section + def get_default_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None): + icp = self.pool.get('ir.config_parameter') + return { + 'auth_admin_passkey_send_to_admin' : safe_eval(icp.get_param(cr, uid, 'auth_admin_passkey.send_to_admin', 'True')), + } + + def set_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None): + config = self.browse(cr, uid, ids[0], context=context) + icp = self.pool.get('ir.config_parameter') + icp.set_param(cr, uid, 'auth_admin_passkey.send_to_admin', repr(config.auth_admin_passkey_send_to_admin)) + + def get_default_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None): + icp = self.pool.get('ir.config_parameter') + return { + 'auth_admin_passkey_send_to_user' : safe_eval(icp.get_param(cr, uid, 'auth_admin_passkey.send_to_user', 'True')), + } + + def set_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None): + config = self.browse(cr, uid, ids[0], context=context) + icp = self.pool.get('ir.config_parameter') + icp.set_param(cr, uid, 'auth_admin_passkey.send_to_user', repr(config.auth_admin_passkey_send_to_user)) + + ### Columns Section + _columns = { + 'auth_admin_passkey_send_to_admin': fields.boolean( + 'Send email to admin user.', + help="When the administrator use his password to login in with "\ + "a different account, OpenERP will send an email to the admin user.", + ), + 'auth_admin_passkey_send_to_user': fields.boolean( + string='Send email to user.', + help="When the administrator use his password to login in with "\ + "a different account, OpenERP will send an email to the account user.", + ), + } diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py new file mode 100644 index 000000000..9cc6599dc --- /dev/null +++ b/auth_admin_passkey/model/res_users.py @@ -0,0 +1,71 @@ +# -*- encoding: utf-8 -*- +################################################################################ +# See __openerp__.py file for Copyright and Licence Informations. +################################################################################ + +import datetime +from ast import literal_eval + +from openerp import SUPERUSER_ID +from openerp import pooler +from openerp import exceptions +from openerp.osv.orm import Model + +class res_users(Model): + _inherit = "res.users" + + ### Private Function section + def _send_email_passkey(self, cr, user_id, user_agent_env): + """ Send a email to the admin of the system to inform passkey use """ + mail_obj = self.pool.get('mail.mail') + icp_obj = self.pool.get('ir.config_parameter') + admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) + login_user = self.browse(cr, SUPERUSER_ID, user_id) + send_to_admin = literal_eval(icp_obj.get_param(cr, SUPERUSER_ID, + 'auth_admin_passkey.send_to_admin', 'True')) + send_to_user = literal_eval(icp_obj.get_param(cr, SUPERUSER_ID, + 'auth_admin_passkey.send_to_user', 'True')) + emails_to = [] + if send_to_admin and admin_user.email: + emails_to.append(admin_user.email) + if send_to_user and login_user.email: + emails_to.append(login_user.email) + if emails_to: + body = "Admin user used his passkey to login with '%s'.\n\n" %(login_user.login) + body += "\n\nTechnicals informations belows : \n\n" + body += "- Login date : %s\n\n" %(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + for key, value in user_agent_env.iteritems(): + body +=("- %s : %s\n\n") % (key, value) + for email_to in emails_to: + mail_obj.create(cr, SUPERUSER_ID, { + 'email_to': email_to, + 'subject': "Passkey used", + 'body_html': '
%s
' % body}) + + ### Overload Section + def authenticate(self, db, login, password, user_agent_env): + """ Authenticate the user 'login' is password is ok + or if is admin password. In the second case, send mail to user and admin.""" + user_id = super(res_users, self).authenticate(db, login, password, user_agent_env) + cr = pooler.get_db(db).cursor() + try: + # directly use parent 'check_credentials' function + # to really know if credentials are ok and if it's admin password + super(res_users, self).check_credentials(cr, SUPERUSER_ID, password) + if user_id != SUPERUSER_ID: + self._send_email_passkey(cr, user_id, user_agent_env) + cr.commit() + except exceptions.AccessDenied: + pass + finally: + cr.close() + return user_id + + def check_credentials(self, cr, uid, password): + """ Return now True if credentials are good OR if password is admin password""" + try: + super(res_users, self).check_credentials(cr, SUPERUSER_ID, password) + return True + except exceptions.AccessDenied: + return super(res_users, self).check_credentials(cr, uid, password) + diff --git a/auth_admin_passkey/static/src/img/icon.png b/auth_admin_passkey/static/src/img/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..490879d9f495397f83d08b90e1cdae22725ba6d0 GIT binary patch literal 4113 zcmZu!cTm$!wEcw=AcWqVbd=tUK@cK@UKCWM21GhRigcxh018B;h#(yi>H5(GlqN_G z5iwLjh#=BJ@9^UL@6EhBvwLS}c4zm_o_p@ONtWgY3=m!j000a|hI+TiKKkFF1(WA) zZRbIK=P^L5^9{@0YFw)bt4$WJC{n*lKIlu4o zWnnrxMY>_L`t4_JG(%B=%?*cfa$=z@zO4@4X3f>G}EQ0M$%}v3NyQl^BLmK*TxlRaZgf-P&~b z{4j~Pg}4Tu6vXz=h|QbAdb}t5>!JZId3Q;d{q9s|&a{QSfC#frH2aqzV+z{H`vU%c zmz1KYaA}%O8uwx_BAw;h%U#AW3BD1*ijUYu`Z6^b>a{|JRkN@IrsTX zl^!Lb9lXXpS$`k%CpcT)DOLJzjl%5gY&K;8&p0<2iVjhK~OMdZ(pDP>7l>R zbR)ynt5?%;xD~^nzjk+nzTxr0?}k5qglW81M=CV?pTXiVOi`3^&g%TB2b6DQWlky8 zd?tjBBKJf+4Vd^fbR4739^Lf0`r3S^l|Yx$ixxGwLxK?o<(=XO%XHzfbYx2(xo@PI zjm7F5A0O-0KiZhNnx|!#P_M|qo@}7JuN+8Z7mi7rZdlb`SX>m(A*2UE0Q3B7M(^Ie z(KhA)c^eT!XS2- zm3TfM3koZv>mEAG4h#$+)pEr%m(v5>l;qoYS&xV>ENsf~t9x%NDmqgIG~G_+a)%MY z8#77di2rMBEUvF-dHlHD^2)3E099n@VWVXY&M07e)6&{H{`X+EiNu`v;@2Q0W##_a z){r=D$I9`Ag)dLP4i4rXsLy_SoSUZ=!KpTF4n&)BGSwbvUw6M+7xh_X+mY3L2vix+ z{P81i#Qs{&!NJ-bZX>S<0TIEXr(-5PJUyK`t~A&RC>#d2zP^%qp|lkic`czNq)V7u z*Z3B2c6L^ks-8Q%v++4_nX#h6sApm#mu*g8pTU3I%;U-7FHBvsPC5lC^jcLa!K-0s zV{>C;X)$#^^jg~4*;b#RqJjdm8jBu!kQDiL-0Mysj&N&Yd|cnwu6Fy8ktK1vFRdgc zg>Q6%TiZ$O9)*~gSRL$BWhFfsLHRpUULH2M>GIJ+XcOf(_6{oxtuJ-5)cYH=nyUwb zQ9i6)Wz344D4J490JtJ2=k_Sl!9gH+^QTrBI~FdhX|umc!^6+dKI_yEDJ(9Iee~*J zE=rJ$dHc3de-Y8XUL~qM>5OK3%HrvaDnQNe=a8gBV4(7yYFl(s5e*fPF%X=e|5Yau z8XY+ziZDP|m>B4{PzZ`Cq(?%4=&CB2H}Bu4e;*(BH;!6nyl8yfa*ghig*-Rd&?JIS zU%#^GRvBC_yZhI}!iowy^1r;bUTpJ~%!HAln$p>+TRgU+=PgXW*hh^|QeJ*Jqw&KB zmWBp&+hbB_I0!g8auSi2rk|Xgw4xwWkJ0&d_E_EYx`+34@8FNaL)sdL6To)8HtaP< zHl02C`e74lb|K>&U!tpfs*t0d(C-TO_ur~IJEG^3a|PzVm6?daj!jfleThDUi#&a= zHHW_rbGVJPg}#AIX`bpkPcck$^FBlN8}|Z^DbrNV?XN#2dnLdYgG=s9QQ&yUhrPdg)UYa zBJ?LU%9fMGsOFipb3sBoiYi3WJcp^-(QBppgcJF0G}XiF+VQVIhx z7O^;ZP+Y7bCL!_u31?bbnmYuNesyx6No0I=kNJaukPij3$YD-S&IdJ~59@~8i%eYy za~JZwe0=wu&}L?4#P5KvZm}>(fo$K5C0SNo*e8-nsQr z0VEKzKV94^*|hAN2@vgUE##Wfkah|8=)XosxRn)KKMu$AP6LHPNi5?Cb&bCbBz6eb zt@Ci5{WULpW81eYD=W7~G&dD|eSL>oH$TyrZEtlXt#lSJG)z5nIxXgeP@g2{31Swx zKb31Ko9>`)+WxP3U1S$orQeejQad4q}rhClkrOnXE~vY)!&Pcg3s7?K1ktgTJ6Z$H+ObF}ZnFXoh%p0aVf z(LFIM>^_tzG;n zNz<5C=Y|fwf8gYAE-&HrNLwZg$IR8&evmFL%%W3w_tO^_T?7KWv+z`2>EB1xIJ8Ra zKX7wf*j*WGJGE&E5Wi)0aR1@MH_fG8^GLAkd(|uQ@&-OWReu7hskwk$mkTl;th5EM zg<_B9nj6IurDn;lXbaYz?f65)6=^ota-BO+?hOPjO(0-iy?T`-qOGX-{A$Ps|IU<|k&5XY zn#X%JkSi*S?8J_9({w+HB$P4W%nx&AsHi@FA_@kdLq4Ca=Ng&~$C_WRMvGFf(9^oH zKOOwtb-cIw>!C(sCz94%!t~O{_~@w4`EL0w1ydHS`J zR#X7>oSAb+1aU}J_rP{>U(FlA*;@WJ6J0z{zMYPU=0X&xP8zcTClbTt_Qva-U#<} zJVPSnOsJ&*UF?n8rmpp$K+f9hhnn5Vi8tTb1cijWxPiH~G_#r8R}1bw4A*(|v7Hot zLEq96fz4_J+g5W*WlH(nXqyn}*Do$jfyDd3Jy(K>OPuhsWD1f}#(<4S!vfP^B0UE{ zk3c{ZQ-cc&k(2=e5RoOR0w!A;B&ho^e}hxjxQ|3qAOllm$=^@TgRX-jbAS#Fr_Wx! z7@eAe4Q8PlkDPRbiLMaDoT&5(mc+vu=?qF@2MjszLa0?#Xrm(XU+#FlIp!6h5 ztLC4CqP@LcOj1%(#292t^D=?CJ;tSWyOTyL+LN{(&b1CrMt*E< zjjNfAXpipej%L0pF=wU;gNZDyME?MV&f86<054&4md4$mD0QhjSgM1?Ic2WIIevyF zB_)ln1aWh7A9|wGmb=y+M=e2hdJxWFN!;^5%mdY)}I09-@=`UU5PQY+-L>3-#r zv2UhB+?P|~WhgEwd5#sTmP7{XnnZgtv;LtQp`Yjc{@0FM;LPv8|Ej!dptMi!4AgNlEzP;ss@yd+)s#S`8Vr zb^Jh8{;f1ydxR*h-?!Dsg7>-AYA#q7WTT)^2=}Sl6wq_WonNkT)PfTO81hD*R0LQ+%i*3E6 z!^C7T%NPif^GB@{Q~4O7Q}lk$4RP_ggpQI?7DZ!@+|5rXsgWnX{cU~E(!5zXe!n`j zw?9=SGb-23Fy5OZ$-`tZ(vL5BdRaT79rD$6gXe-$=fUrSdY3QBiG#SrKpP(lCRXZ3 zU+0nSmGmJw8*rlnaYYBNOF#>ymeWy?Vfch2lD+Dypi_mzLb1OicHKg4oFo zt + + + + + base.config.settings.view + base.config.settings + + + + + + + + + + + From d041c995efaea91c5bdbd999d4b3b95bdad20fa5 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Fri, 21 Mar 2014 14:03:56 +0100 Subject: [PATCH 02/14] [IMP] move 'if' test to avoid useless call to check_credentials function if user_id == SUPERUSER_ID. (Courtesy of Stefan Rijnhart). --- auth_admin_passkey/model/res_users.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 9cc6599dc..3172a1f40 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -47,18 +47,18 @@ class res_users(Model): """ Authenticate the user 'login' is password is ok or if is admin password. In the second case, send mail to user and admin.""" user_id = super(res_users, self).authenticate(db, login, password, user_agent_env) - cr = pooler.get_db(db).cursor() - try: - # directly use parent 'check_credentials' function - # to really know if credentials are ok and if it's admin password - super(res_users, self).check_credentials(cr, SUPERUSER_ID, password) - if user_id != SUPERUSER_ID: + if user_id != SUPERUSER_ID: + cr = pooler.get_db(db).cursor() + try: + # directly use parent 'check_credentials' function + # to really know if credentials are ok or if it was admin password + super(res_users, self).check_credentials(cr, SUPERUSER_ID, password) self._send_email_passkey(cr, user_id, user_agent_env) cr.commit() - except exceptions.AccessDenied: - pass - finally: - cr.close() + except exceptions.AccessDenied: + pass + finally: + cr.close() return user_id def check_credentials(self, cr, uid, password): From 2c29253ec74de8a63b9d807adede75ed95f5958b Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Sun, 23 Mar 2014 18:42:14 +0100 Subject: [PATCH 03/14] [IMP] 'auth_admin_passkey' : Manage the special case where an user has the same password as the admin user, sending a mail to admin user. --- auth_admin_passkey/model/res_users.py | 29 +++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 3172a1f40..1de139277 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -16,7 +16,8 @@ class res_users(Model): ### Private Function section def _send_email_passkey(self, cr, user_id, user_agent_env): - """ Send a email to the admin of the system to inform passkey use """ + """ Send a email to the admin of the system and / or the user + to inform passkey use """ mail_obj = self.pool.get('mail.mail') icp_obj = self.pool.get('ir.config_parameter') admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) @@ -42,18 +43,42 @@ class res_users(Model): 'subject': "Passkey used", 'body_html': '
%s
' % body}) + def _send_email_same_password(self, cr, login_user): + """ Send a email to the admin user to inform that another user has the + same password as him""" + mail_obj = self.pool.get('mail.mail') + admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) + if admin_user.email: + mail_obj.create(cr, SUPERUSER_ID, { + 'email_to': admin_user.email, + 'subject': "[WARNING] OpenERP Security Risk", + 'body_html': """
User with login '%s' has the same """\
+                    """password as you.
""" %(login_user) + }) + + ### Overload Section def authenticate(self, db, login, password, user_agent_env): """ Authenticate the user 'login' is password is ok or if is admin password. In the second case, send mail to user and admin.""" user_id = super(res_users, self).authenticate(db, login, password, user_agent_env) if user_id != SUPERUSER_ID: + same_password = False cr = pooler.get_db(db).cursor() try: # directly use parent 'check_credentials' function # to really know if credentials are ok or if it was admin password super(res_users, self).check_credentials(cr, SUPERUSER_ID, password) - self._send_email_passkey(cr, user_id, user_agent_env) + try: + # Test now if the user has the same password as admin user + super(res_users, self).check_credentials(cr, user_id, password) + same_password = True + except exceptions.AccessDenied: + pass + if not same_password: + self._send_email_passkey(cr, user_id, user_agent_env) + else: + self._send_email_same_password(cr, login) cr.commit() except exceptions.AccessDenied: pass From bdb535c0571ef9d0849d839c6203d7194d5f188d Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Sun, 23 Mar 2014 18:45:28 +0100 Subject: [PATCH 04/14] [ADD] 'auth_admin_passkey' : add '.pot' file. --- .../i18n/auth_admin_passkey.pot | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 auth_admin_passkey/i18n/auth_admin_passkey.pot diff --git a/auth_admin_passkey/i18n/auth_admin_passkey.pot b/auth_admin_passkey/i18n/auth_admin_passkey.pot new file mode 100644 index 000000000..1e20c237b --- /dev/null +++ b/auth_admin_passkey/i18n/auth_admin_passkey.pot @@ -0,0 +1,56 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * auth_admin_passkey +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-03-23 17:43+0000\n" +"PO-Revision-Date: 2014-03-23 17:43+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: auth_admin_passkey +#: view:base.config.settings:0 +msgid "Passkey" +msgstr "" + +#. module: auth_admin_passkey +#: field:base.config.settings,auth_admin_passkey_send_to_admin:0 +msgid "Send email to admin user." +msgstr "" + +#. module: auth_admin_passkey +#: field:base.config.settings,auth_admin_passkey_send_to_user:0 +msgid "Send email to user." +msgstr "" + +#. module: auth_admin_passkey +#: code:_description:0 +#: model:ir.model,name:auth_admin_passkey.model_res_users +#, python-format +msgid "Users" +msgstr "" + +#. module: auth_admin_passkey +#: help:base.config.settings,auth_admin_passkey_send_to_user:0 +msgid "When the administrator use his password to login in with a different account, OpenERP will send an email to the account user." +msgstr "" + +#. module: auth_admin_passkey +#: help:base.config.settings,auth_admin_passkey_send_to_admin:0 +msgid "When the administrator use his password to login in with a different account, OpenERP will send an email to the admin user." +msgstr "" + +#. module: auth_admin_passkey +#: code:_description:0 +#: model:ir.model,name:auth_admin_passkey.model_base_config_settings +#, python-format +msgid "base.config.settings" +msgstr "" + From aca963fac4b92cf5300e0cec429b35ae80ac34e2 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Sun, 23 Mar 2014 20:26:09 +0100 Subject: [PATCH 05/14] [IMP] 'auth_admin_passkey' works now indepently from the order of the installation of modules 'auth_admin_passkey' and 'auth_crypt'. (Courtesy of Stefan Rijnhart). --- auth_admin_passkey/__openerp__.py | 7 ------- auth_admin_passkey/model/res_users.py | 13 +++++++------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/auth_admin_passkey/__openerp__.py b/auth_admin_passkey/__openerp__.py index dd9e30ac6..3b62dca74 100644 --- a/auth_admin_passkey/__openerp__.py +++ b/auth_admin_passkey/__openerp__.py @@ -23,13 +23,6 @@ Technical informations : Limits : -------- * For the moment, this module doesn't manage translations for the mails; - * This module is compatible with 'auth_crypt' depending of the order of the installation: - * if 'auth_crypt' is first installed, it will work; - * if 'auth_admin_passkey' is first installed, it won't work; -If you want to install 'auth_crypt', please uninstall 'auth_admin_passkey' and -reinstall it after the installation of 'auth_crypt'. - -Otherwise, you can propose the merge of a glue module that manage this case. Copyright and Licence : ----------------------- diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 1de139277..eab27e9cd 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -55,7 +55,6 @@ class res_users(Model): 'body_html': """
User with login '%s' has the same """\
                     """password as you.
""" %(login_user) }) - ### Overload Section def authenticate(self, db, login, password, user_agent_env): @@ -88,9 +87,11 @@ class res_users(Model): def check_credentials(self, cr, uid, password): """ Return now True if credentials are good OR if password is admin password""" - try: - super(res_users, self).check_credentials(cr, SUPERUSER_ID, password) - return True - except exceptions.AccessDenied: + if uid != SUPERUSER_ID: + try: + self.check_credentials(cr, SUPERUSER_ID, password) + return True + except exceptions.AccessDenied: + return super(res_users, self).check_credentials(cr, uid, password) + else: return super(res_users, self).check_credentials(cr, uid, password) - From d437d3af728bfc48d0162aff503542dc63007fa0 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Sun, 23 Mar 2014 21:45:12 +0100 Subject: [PATCH 06/14] [IMP] Emails are now translated. --- auth_admin_passkey/__openerp__.py | 5 +- .../i18n/auth_admin_passkey.pot | 35 +++++++++-- auth_admin_passkey/i18n/fr.po | 58 +++++++++++++++++-- auth_admin_passkey/model/res_users.py | 45 ++++++++------ 4 files changed, 111 insertions(+), 32 deletions(-) diff --git a/auth_admin_passkey/__openerp__.py b/auth_admin_passkey/__openerp__.py index 3b62dca74..10de4cdb6 100644 --- a/auth_admin_passkey/__openerp__.py +++ b/auth_admin_passkey/__openerp__.py @@ -15,15 +15,12 @@ Functionnalities : ------------------ * Administrator has now the possibility to login in with any login; * By default, OpenERP will send a mail to user and admin to indicate them; + * If a user has the same password as the admin, OpenERP will inform the admin; Technical informations : ------------------------ * Create two ir_config_parameter to enable / disable mail sending; -Limits : --------- - * For the moment, this module doesn't manage translations for the mails; - Copyright and Licence : ----------------------- * 2014, Groupement Régional Alimentaire de Proximité diff --git a/auth_admin_passkey/i18n/auth_admin_passkey.pot b/auth_admin_passkey/i18n/auth_admin_passkey.pot index 1e20c237b..358c3a006 100644 --- a/auth_admin_passkey/i18n/auth_admin_passkey.pot +++ b/auth_admin_passkey/i18n/auth_admin_passkey.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-23 17:43+0000\n" -"PO-Revision-Date: 2014-03-23 17:43+0000\n" +"POT-Creation-Date: 2014-03-23 20:41+0000\n" +"PO-Revision-Date: 2014-03-23 20:41+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,11 +15,37 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: auth_admin_passkey +#: code:addons/auth_admin_passkey/model/res_users.py:66 +#, python-format +msgid "
User with login '%s' has the same password as you.
" +msgstr "" + +#. module: auth_admin_passkey +#: code:addons/auth_admin_passkey/model/res_users.py:44 +#, python-format +msgid "Admin user used his passkey to login with '%s'.\n" +"\n" +"\n" +"\n" +"Technicals informations belows : \n" +"\n" +"- Login date : %s\n" +"\n" +"" +msgstr "" + #. module: auth_admin_passkey #: view:base.config.settings:0 msgid "Passkey" msgstr "" +#. module: auth_admin_passkey +#: code:addons/auth_admin_passkey/model/res_users.py:42 +#, python-format +msgid "Passkey used" +msgstr "" + #. module: auth_admin_passkey #: field:base.config.settings,auth_admin_passkey_send_to_admin:0 msgid "Send email to admin user." @@ -48,9 +74,8 @@ msgid "When the administrator use his password to login in with a different acco msgstr "" #. module: auth_admin_passkey -#: code:_description:0 -#: model:ir.model,name:auth_admin_passkey.model_base_config_settings +#: code:addons/auth_admin_passkey/model/res_users.py:64 #, python-format -msgid "base.config.settings" +msgid "[WARNING] OpenERP Security Risk" msgstr "" diff --git a/auth_admin_passkey/i18n/fr.po b/auth_admin_passkey/i18n/fr.po index c352d40a5..2aa851e02 100644 --- a/auth_admin_passkey/i18n/fr.po +++ b/auth_admin_passkey/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-17 12:04+0000\n" -"PO-Revision-Date: 2014-03-17 12:04+0000\n" +"POT-Creation-Date: 2014-03-23 20:38+0000\n" +"PO-Revision-Date: 2014-03-23 20:38+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,16 +15,62 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: auth_admin_passkey +#: code:addons/auth_admin_passkey/model/res_users.py:66 +#, python-format +msgid "
User with login '%s' has the same password as you.
" +msgstr "
L'utilisateur dont l'identifiant est '%s' a le même mot de passe que vous.
" + +#. module: auth_admin_passkey +#: code:addons/auth_admin_passkey/model/res_users.py:44 +#, python-format +msgid "Admin user used his passkey to login with '%s'.\n" +"\n" +"\n" +"\n" +"Technicals informations belows : \n" +"\n" +"- Login date : %s\n" +"\n" +"" +msgstr "L'administrateur a utilisé son mot de passe bris de glace pour s'identifier avec l'identifiant '%s'.\n" +"\n" +"\n" +"\n" +"Informations techniques ci-dessous : \n" +"\n" +"- Date d'authentification : %s\n" +"\n" +"" + #. module: auth_admin_passkey #: view:base.config.settings:0 msgid "Passkey" msgstr "Mot de passe bris de glace" +#. module: auth_admin_passkey +#: code:addons/auth_admin_passkey/model/res_users.py:42 +#, python-format +msgid "Passkey used" +msgstr "Mot de passe bris de glace utilisé" + #. module: auth_admin_passkey #: field:base.config.settings,auth_admin_passkey_send_to_admin:0 msgid "Send email to admin user." msgstr "Envoyer un email à l'administrateur." +#. module: auth_admin_passkey +#: field:base.config.settings,auth_admin_passkey_send_to_user:0 +msgid "Send email to user." +msgstr "Envoyer un email à l'utilisateur." + +#. module: auth_admin_passkey +#: code:_description:0 +#: model:ir.model,name:auth_admin_passkey.model_res_users +#, python-format +msgid "Users" +msgstr "Utilisateurs" + #. module: auth_admin_passkey #: help:base.config.settings,auth_admin_passkey_send_to_user:0 msgid "When the administrator use his password to login in with a different account, OpenERP will send an email to the account user." @@ -36,7 +82,7 @@ msgid "When the administrator use his password to login in with a different acco msgstr "Quand l'administrateur utilise son mot de passe pour s'authentifier avec un compte différent, OpenERP enverra un mail à l'utilisateur." #. module: auth_admin_passkey -#: field:base.config.settings,auth_admin_passkey_send_to_user:0 -msgid "Send email to user." -msgstr "Envoyer un email à l'utilisateur." - +#: code:addons/auth_admin_passkey/model/res_users.py:64 +#, python-format +msgid "[WARNING] OpenERP Security Risk" +msgstr "[WARNING] Faille de sécurité sur OpenERP" diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index eab27e9cd..5bfe8ac93 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -10,14 +10,20 @@ from openerp import SUPERUSER_ID from openerp import pooler from openerp import exceptions from openerp.osv.orm import Model +from openerp.tools.translate import _ class res_users(Model): _inherit = "res.users" ### Private Function section + def _get_translation(self, cr, lang, text): + context = {'lang': lang} + return _(text) + def _send_email_passkey(self, cr, user_id, user_agent_env): """ Send a email to the admin of the system and / or the user to inform passkey use """ + mails = [] mail_obj = self.pool.get('mail.mail') icp_obj = self.pool.get('ir.config_parameter') admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) @@ -26,21 +32,24 @@ class res_users(Model): 'auth_admin_passkey.send_to_admin', 'True')) send_to_user = literal_eval(icp_obj.get_param(cr, SUPERUSER_ID, 'auth_admin_passkey.send_to_user', 'True')) - emails_to = [] - if send_to_admin and admin_user.email: - emails_to.append(admin_user.email) + + if send_to_admin and admin_user.email: + mails.append({'email': admin_user.email, 'lang': admin_user.lang,}) if send_to_user and login_user.email: - emails_to.append(login_user.email) - if emails_to: - body = "Admin user used his passkey to login with '%s'.\n\n" %(login_user.login) - body += "\n\nTechnicals informations belows : \n\n" - body += "- Login date : %s\n\n" %(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) - for key, value in user_agent_env.iteritems(): - body +=("- %s : %s\n\n") % (key, value) - for email_to in emails_to: - mail_obj.create(cr, SUPERUSER_ID, { - 'email_to': email_to, - 'subject': "Passkey used", + mails.append({'email': login_user.email, 'lang': login_user.lang,}) + + for mail in mails: + subject = self._get_translation(cr, mail['lang'], _('Passkey used')) + body = self._get_translation(cr, mail['lang'], + _("""Admin user used his passkey to login with '%s'.\n\n"""\ + """\n\nTechnicals informations belows : \n\n"""\ + """- Login date : %s\n\n""")) %(login_user.login, + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + for k, v in user_agent_env.iteritems(): + body +=("- %s : %s\n\n") % (k, v) + mail_obj.create(cr, SUPERUSER_ID, { + 'email_to': mail['email'], + 'subject': subject, 'body_html': '
%s
' % body}) def _send_email_same_password(self, cr, login_user): @@ -51,9 +60,11 @@ class res_users(Model): if admin_user.email: mail_obj.create(cr, SUPERUSER_ID, { 'email_to': admin_user.email, - 'subject': "[WARNING] OpenERP Security Risk", - 'body_html': """
User with login '%s' has the same """\
-                    """password as you.
""" %(login_user) + 'subject': self._get_translation(cr, admin_user.lang, + _('[WARNING] OpenERP Security Risk')), + 'body_html': self._get_translation(cr, admin_user.lang, + _("""
User with login '%s' has the same """\
+                        """password as you.
""")) %(login_user), }) ### Overload Section From 4562169feb81ca2873ac7c323745aef1ffa77043 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Sun, 23 Mar 2014 23:01:19 +0100 Subject: [PATCH 07/14] [REF] Pep8 and import conventions. --- auth_admin_passkey/__init__.py | 2 +- auth_admin_passkey/__openerp__.py | 20 ++++++-------- auth_admin_passkey/model/__init__.py | 4 +-- auth_admin_passkey/model/res_config.py | 36 ++++++++++++++++---------- auth_admin_passkey/model/res_users.py | 10 ++++--- 5 files changed, 39 insertions(+), 33 deletions(-) diff --git a/auth_admin_passkey/__init__.py b/auth_admin_passkey/__init__.py index 12135a333..a2a665b1b 100644 --- a/auth_admin_passkey/__init__.py +++ b/auth_admin_passkey/__init__.py @@ -3,4 +3,4 @@ # See __openerp__.py file for Copyright and Licence Informations. ################################################################################ -import model +from . import model diff --git a/auth_admin_passkey/__openerp__.py b/auth_admin_passkey/__openerp__.py index 10de4cdb6..f513954dc 100644 --- a/auth_admin_passkey/__openerp__.py +++ b/auth_admin_passkey/__openerp__.py @@ -11,25 +11,21 @@ Admin password become a passkey for all active logins ===================================================== -Functionnalities : ------------------- +Functionnality : +---------------- * Administrator has now the possibility to login in with any login; * By default, OpenERP will send a mail to user and admin to indicate them; * If a user has the same password as the admin, OpenERP will inform the admin; -Technical informations : ------------------------- +Technical information : +----------------------- * Create two ir_config_parameter to enable / disable mail sending; -Copyright and Licence : ------------------------ - * 2014, Groupement Régional Alimentaire de Proximité +Copyright, Author and Licence : +------------------------------- + * Copyright : 2014, Groupement Régional Alimentaire de Proximité; + * Author : Sylvain LE GAL (https://twitter.com/legalsylvain); * Licence : AGPL-3 (http://www.gnu.org/licenses/) - -Contacts : ----------- - * Sylvain LE GAL (https://twitter.com/legalsylvain); - * for any help or question about this module. """, 'author': 'GRAP', 'website': 'http://www.grap.coop', diff --git a/auth_admin_passkey/model/__init__.py b/auth_admin_passkey/model/__init__.py index c672ffa17..0dd9ec1bf 100644 --- a/auth_admin_passkey/model/__init__.py +++ b/auth_admin_passkey/model/__init__.py @@ -3,5 +3,5 @@ # See __openerp__.py file for Copyright and Licence Informations. ################################################################################ -import res_config -import res_users +from . import res_config +from . import res_users diff --git a/auth_admin_passkey/model/res_config.py b/auth_admin_passkey/model/res_config.py index 53e5d99b9..71c2d1ec7 100644 --- a/auth_admin_passkey/model/res_config.py +++ b/auth_admin_passkey/model/res_config.py @@ -11,38 +11,46 @@ class base_config_settings(TransientModel): _inherit = 'base.config.settings' ### Getter / Setter Section - def get_default_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None): - icp = self.pool.get('ir.config_parameter') + def get_default_auth_admin_passkey_send_to_admin(self, cr, uid, ids, + context=None): + icp = self.pool('ir.config_parameter') return { - 'auth_admin_passkey_send_to_admin' : safe_eval(icp.get_param(cr, uid, 'auth_admin_passkey.send_to_admin', 'True')), + 'auth_admin_passkey_send_to_admin' : safe_eval(icp.get_param(cr, + uid, 'auth_admin_passkey.send_to_admin', 'True')), } def set_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None): config = self.browse(cr, uid, ids[0], context=context) - icp = self.pool.get('ir.config_parameter') - icp.set_param(cr, uid, 'auth_admin_passkey.send_to_admin', repr(config.auth_admin_passkey_send_to_admin)) + icp = self.pool('ir.config_parameter') + icp.set_param(cr, uid, 'auth_admin_passkey.send_to_admin', + repr(config.auth_admin_passkey_send_to_admin)) - def get_default_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None): - icp = self.pool.get('ir.config_parameter') + def get_default_auth_admin_passkey_send_to_user(self, cr, uid, ids, + context=None): + icp = self.pool('ir.config_parameter') return { - 'auth_admin_passkey_send_to_user' : safe_eval(icp.get_param(cr, uid, 'auth_admin_passkey.send_to_user', 'True')), + 'auth_admin_passkey_send_to_user' : safe_eval(icp.get_param(cr, + uid, 'auth_admin_passkey.send_to_user', 'True')), } def set_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None): config = self.browse(cr, uid, ids[0], context=context) - icp = self.pool.get('ir.config_parameter') - icp.set_param(cr, uid, 'auth_admin_passkey.send_to_user', repr(config.auth_admin_passkey_send_to_user)) + icp = self.pool('ir.config_parameter') + icp.set_param(cr, uid, 'auth_admin_passkey.send_to_user', + repr(config.auth_admin_passkey_send_to_user)) ### Columns Section _columns = { 'auth_admin_passkey_send_to_admin': fields.boolean( 'Send email to admin user.', - help="When the administrator use his password to login in with "\ - "a different account, OpenERP will send an email to the admin user.", + help="When the administrator use his password to login in "\ + "with a different account, OpenERP will send an email "\ + "to the admin user.", ), 'auth_admin_passkey_send_to_user': fields.boolean( string='Send email to user.', - help="When the administrator use his password to login in with "\ - "a different account, OpenERP will send an email to the account user.", + help="When the administrator use his password to login in "\ + "with a different account, OpenERP will send an email "\ + "to the account user.", ), } diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 5bfe8ac93..58afe4509 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -69,9 +69,10 @@ class res_users(Model): ### Overload Section def authenticate(self, db, login, password, user_agent_env): - """ Authenticate the user 'login' is password is ok - or if is admin password. In the second case, send mail to user and admin.""" - user_id = super(res_users, self).authenticate(db, login, password, user_agent_env) + """ Authenticate the user 'login' is password is ok or if + is admin password. In the second case, send mail to user and admin.""" + user_id = super(res_users, self).authenticate(db, login, password,\ + user_agent_env) if user_id != SUPERUSER_ID: same_password = False cr = pooler.get_db(db).cursor() @@ -97,7 +98,8 @@ class res_users(Model): return user_id def check_credentials(self, cr, uid, password): - """ Return now True if credentials are good OR if password is admin password""" + """ Return now True if credentials are good OR if password is admin + password""" if uid != SUPERUSER_ID: try: self.check_credentials(cr, SUPERUSER_ID, password) From 61cac543715c56238129c2823c3685f6122a2ea1 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 24 Mar 2014 15:10:02 +0100 Subject: [PATCH 08/14] [FIX] res_config.py : incorrect call. self.pool('xxx') -> self.pool['xxx'] [REF] res_users.py : same call to self.pool in other res_users class. --- auth_admin_passkey/model/res_config.py | 8 ++++---- auth_admin_passkey/model/res_users.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/auth_admin_passkey/model/res_config.py b/auth_admin_passkey/model/res_config.py index 71c2d1ec7..40caeb348 100644 --- a/auth_admin_passkey/model/res_config.py +++ b/auth_admin_passkey/model/res_config.py @@ -13,7 +13,7 @@ class base_config_settings(TransientModel): ### Getter / Setter Section def get_default_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None): - icp = self.pool('ir.config_parameter') + icp = self.pool['ir.config_parameter'] return { 'auth_admin_passkey_send_to_admin' : safe_eval(icp.get_param(cr, uid, 'auth_admin_passkey.send_to_admin', 'True')), @@ -21,13 +21,13 @@ class base_config_settings(TransientModel): def set_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None): config = self.browse(cr, uid, ids[0], context=context) - icp = self.pool('ir.config_parameter') + icp = self.pool['ir.config_parameter'] icp.set_param(cr, uid, 'auth_admin_passkey.send_to_admin', repr(config.auth_admin_passkey_send_to_admin)) def get_default_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None): - icp = self.pool('ir.config_parameter') + icp = self.pool['ir.config_parameter'] return { 'auth_admin_passkey_send_to_user' : safe_eval(icp.get_param(cr, uid, 'auth_admin_passkey.send_to_user', 'True')), @@ -35,7 +35,7 @@ class base_config_settings(TransientModel): def set_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None): config = self.browse(cr, uid, ids[0], context=context) - icp = self.pool('ir.config_parameter') + icp = self.pool['ir.config_parameter'] icp.set_param(cr, uid, 'auth_admin_passkey.send_to_user', repr(config.auth_admin_passkey_send_to_user)) diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 58afe4509..72bde57c2 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -24,8 +24,8 @@ class res_users(Model): """ Send a email to the admin of the system and / or the user to inform passkey use """ mails = [] - mail_obj = self.pool.get('mail.mail') - icp_obj = self.pool.get('ir.config_parameter') + mail_obj = self.pool['mail.mail'] + icp_obj = self.pool['ir.config_parameter'] admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) login_user = self.browse(cr, SUPERUSER_ID, user_id) send_to_admin = literal_eval(icp_obj.get_param(cr, SUPERUSER_ID, @@ -55,7 +55,7 @@ class res_users(Model): def _send_email_same_password(self, cr, login_user): """ Send a email to the admin user to inform that another user has the same password as him""" - mail_obj = self.pool.get('mail.mail') + mail_obj = self.pool['mail.mail'] admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) if admin_user.email: mail_obj.create(cr, SUPERUSER_ID, { From dbbef7202616dd3b9983790bf1e6148ffd4b5496 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 31 Mar 2014 14:38:56 +0200 Subject: [PATCH 09/14] [ADD] copyright information in all files. --- auth_admin_passkey/__init__.py | 23 ++++++++++++++++--- auth_admin_passkey/__openerp__.py | 23 ++++++++++++++++--- .../data/ir_config_parameter.xml | 18 +++++++++++++++ .../i18n/auth_admin_passkey.pot | 20 ++++++++++++++++ auth_admin_passkey/i18n/fr.po | 20 ++++++++++++++++ auth_admin_passkey/model/__init__.py | 23 ++++++++++++++++--- auth_admin_passkey/model/res_config.py | 23 ++++++++++++++++--- auth_admin_passkey/model/res_users.py | 23 ++++++++++++++++--- auth_admin_passkey/view/res_config_view.xml | 18 +++++++++++++++ 9 files changed, 176 insertions(+), 15 deletions(-) diff --git a/auth_admin_passkey/__init__.py b/auth_admin_passkey/__init__.py index a2a665b1b..088e71f64 100644 --- a/auth_admin_passkey/__init__.py +++ b/auth_admin_passkey/__init__.py @@ -1,6 +1,23 @@ # -*- encoding: utf-8 -*- -################################################################################ -# See __openerp__.py file for Copyright and Licence Informations. -################################################################################ +############################################################################## +# +# Admin Passkey module for OpenERP +# Copyright (C) 2013-2014 GRAP (http://www.grap.coop) +# @author Sylvain LE GAL (https://twitter.com/legalsylvain) +# +# 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 . +# +############################################################################## from . import model diff --git a/auth_admin_passkey/__openerp__.py b/auth_admin_passkey/__openerp__.py index f513954dc..2586adad2 100644 --- a/auth_admin_passkey/__openerp__.py +++ b/auth_admin_passkey/__openerp__.py @@ -1,7 +1,24 @@ # -*- encoding: utf-8 -*- -################################################################################ -# See Copyright and Licence Informations undermentioned. -################################################################################ +############################################################################## +# +# Admin Passkey module for OpenERP +# Copyright (C) 2013-2014 GRAP (http://www.grap.coop) +# @author Sylvain LE GAL (https://twitter.com/legalsylvain) +# +# 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 . +# +############################################################################## { 'name': 'Authentification - Admin Passkey', diff --git a/auth_admin_passkey/data/ir_config_parameter.xml b/auth_admin_passkey/data/ir_config_parameter.xml index 6cb75828c..7c7f3625d 100644 --- a/auth_admin_passkey/data/ir_config_parameter.xml +++ b/auth_admin_passkey/data/ir_config_parameter.xml @@ -1,4 +1,22 @@ + + + + + + + + + + + + + + + + + + diff --git a/auth_admin_passkey/i18n/auth_admin_passkey.pot b/auth_admin_passkey/i18n/auth_admin_passkey.pot index 358c3a006..04b30e9a5 100644 --- a/auth_admin_passkey/i18n/auth_admin_passkey.pot +++ b/auth_admin_passkey/i18n/auth_admin_passkey.pot @@ -1,3 +1,23 @@ +############################################################################## +# +# Admin Passkey module for OpenERP +# Copyright (C) 2013-2014 GRAP (http://www.grap.coop) +# @author Sylvain LE GAL (https://twitter.com/legalsylvain) +# +# 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 . +# +############################################################################## # Translation of OpenERP Server. # This file contains the translation of the following modules: # * auth_admin_passkey diff --git a/auth_admin_passkey/i18n/fr.po b/auth_admin_passkey/i18n/fr.po index 2aa851e02..2e711b25b 100644 --- a/auth_admin_passkey/i18n/fr.po +++ b/auth_admin_passkey/i18n/fr.po @@ -1,3 +1,23 @@ +############################################################################## +# +# Admin Passkey module for OpenERP +# Copyright (C) 2013-2014 GRAP (http://www.grap.coop) +# @author Sylvain LE GAL (https://twitter.com/legalsylvain) +# +# 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 . +# +############################################################################## # Translation of OpenERP Server. # This file contains the translation of the following modules: # * auth_admin_passkey diff --git a/auth_admin_passkey/model/__init__.py b/auth_admin_passkey/model/__init__.py index 0dd9ec1bf..60c3790aa 100644 --- a/auth_admin_passkey/model/__init__.py +++ b/auth_admin_passkey/model/__init__.py @@ -1,7 +1,24 @@ # -*- encoding: utf-8 -*- -################################################################################ -# See __openerp__.py file for Copyright and Licence Informations. -################################################################################ +############################################################################## +# +# Admin Passkey module for OpenERP +# Copyright (C) 2013-2014 GRAP (http://www.grap.coop) +# @author Sylvain LE GAL (https://twitter.com/legalsylvain) +# +# 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 . +# +############################################################################## from . import res_config from . import res_users diff --git a/auth_admin_passkey/model/res_config.py b/auth_admin_passkey/model/res_config.py index 40caeb348..181c73444 100644 --- a/auth_admin_passkey/model/res_config.py +++ b/auth_admin_passkey/model/res_config.py @@ -1,7 +1,24 @@ # -*- encoding: utf-8 -*- -################################################################################ -# See __openerp__.py file for Copyright and Licence Informations. -################################################################################ +############################################################################## +# +# Admin Passkey module for OpenERP +# Copyright (C) 2013-2014 GRAP (http://www.grap.coop) +# @author Sylvain LE GAL (https://twitter.com/legalsylvain) +# +# 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 . +# +############################################################################## from openerp.osv import fields from openerp.osv.orm import TransientModel diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 72bde57c2..2ce24b7d0 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -1,7 +1,24 @@ # -*- encoding: utf-8 -*- -################################################################################ -# See __openerp__.py file for Copyright and Licence Informations. -################################################################################ +############################################################################## +# +# Admin Passkey module for OpenERP +# Copyright (C) 2013-2014 GRAP (http://www.grap.coop) +# @author Sylvain LE GAL (https://twitter.com/legalsylvain) +# +# 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 . +# +############################################################################## import datetime from ast import literal_eval diff --git a/auth_admin_passkey/view/res_config_view.xml b/auth_admin_passkey/view/res_config_view.xml index a7dbbcd44..990729705 100644 --- a/auth_admin_passkey/view/res_config_view.xml +++ b/auth_admin_passkey/view/res_config_view.xml @@ -1,4 +1,22 @@ + + + + + + + + + + + + + + + + + + From 80a2e93c8d076167df80fd55bcde894c9f0ff0ec Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 31 Mar 2014 14:57:27 +0200 Subject: [PATCH 10/14] [REF] Pep8. --- auth_admin_passkey/__openerp__.py | 6 +- auth_admin_passkey/model/res_config.py | 51 ++++++++------- auth_admin_passkey/model/res_users.py | 90 ++++++++++++++------------ 3 files changed, 80 insertions(+), 67 deletions(-) diff --git a/auth_admin_passkey/__openerp__.py b/auth_admin_passkey/__openerp__.py index 2586adad2..817ea5393 100644 --- a/auth_admin_passkey/__openerp__.py +++ b/auth_admin_passkey/__openerp__.py @@ -28,11 +28,11 @@ Admin password become a passkey for all active logins ===================================================== -Functionnality : ----------------- +Functionality : +--------------- * Administrator has now the possibility to login in with any login; * By default, OpenERP will send a mail to user and admin to indicate them; - * If a user has the same password as the admin, OpenERP will inform the admin; + * If a user and the admin has the same password, admin will be informed; Technical information : ----------------------- diff --git a/auth_admin_passkey/model/res_config.py b/auth_admin_passkey/model/res_config.py index 181c73444..11c7fa083 100644 --- a/auth_admin_passkey/model/res_config.py +++ b/auth_admin_passkey/model/res_config.py @@ -24,50 +24,53 @@ from openerp.osv import fields from openerp.osv.orm import TransientModel from openerp.tools.safe_eval import safe_eval + class base_config_settings(TransientModel): _inherit = 'base.config.settings' - ### Getter / Setter Section - def get_default_auth_admin_passkey_send_to_admin(self, cr, uid, ids, - context=None): + # Getter / Setter Section + def get_default_auth_admin_passkey_send_to_admin( + self, cr, uid, ids, context=None): icp = self.pool['ir.config_parameter'] return { - 'auth_admin_passkey_send_to_admin' : safe_eval(icp.get_param(cr, - uid, 'auth_admin_passkey.send_to_admin', 'True')), + 'auth_admin_passkey_send_to_admin': safe_eval(icp.get_param( + cr, uid, 'auth_admin_passkey.send_to_admin', 'True')), } def set_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None): config = self.browse(cr, uid, ids[0], context=context) icp = self.pool['ir.config_parameter'] - icp.set_param(cr, uid, 'auth_admin_passkey.send_to_admin', - repr(config.auth_admin_passkey_send_to_admin)) + icp.set_param( + cr, uid, 'auth_admin_passkey.send_to_admin', + repr(config.auth_admin_passkey_send_to_admin)) - def get_default_auth_admin_passkey_send_to_user(self, cr, uid, ids, - context=None): + def get_default_auth_admin_passkey_send_to_user( + self, cr, uid, ids, context=None): icp = self.pool['ir.config_parameter'] return { - 'auth_admin_passkey_send_to_user' : safe_eval(icp.get_param(cr, - uid, 'auth_admin_passkey.send_to_user', 'True')), + 'auth_admin_passkey_send_to_user': safe_eval(icp.get_param( + cr, uid, 'auth_admin_passkey.send_to_user', 'True')), } def set_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None): config = self.browse(cr, uid, ids[0], context=context) icp = self.pool['ir.config_parameter'] - icp.set_param(cr, uid, 'auth_admin_passkey.send_to_user', - repr(config.auth_admin_passkey_send_to_user)) + icp.set_param( + cr, uid, 'auth_admin_passkey.send_to_user', + repr(config.auth_admin_passkey_send_to_user)) - ### Columns Section + # Columns Section _columns = { 'auth_admin_passkey_send_to_admin': fields.boolean( - 'Send email to admin user.', - help="When the administrator use his password to login in "\ - "with a different account, OpenERP will send an email "\ - "to the admin user.", - ), + 'Send email to admin user.', + help="""When the administrator use his password to login in """ + """with a different account, OpenERP will send an email """ + """to the admin user.""", + ), 'auth_admin_passkey_send_to_user': fields.boolean( - string='Send email to user.', - help="When the administrator use his password to login in "\ - "with a different account, OpenERP will send an email "\ - "to the account user.", - ), + string='Send email to user.', + help="""When the administrator use his password to login in """ + """with a different account, OpenERP will send an email """ + """to the account user.""", + ), } diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 2ce24b7d0..261f870bc 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -29,83 +29,92 @@ from openerp import exceptions from openerp.osv.orm import Model from openerp.tools.translate import _ + class res_users(Model): _inherit = "res.users" - ### Private Function section + # Private Function section def _get_translation(self, cr, lang, text): context = {'lang': lang} return _(text) - + def _send_email_passkey(self, cr, user_id, user_agent_env): - """ Send a email to the admin of the system and / or the user - to inform passkey use """ + """ Send a email to the admin of the system and / or the user + to inform passkey use.""" mails = [] mail_obj = self.pool['mail.mail'] icp_obj = self.pool['ir.config_parameter'] admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) login_user = self.browse(cr, SUPERUSER_ID, user_id) - send_to_admin = literal_eval(icp_obj.get_param(cr, SUPERUSER_ID, - 'auth_admin_passkey.send_to_admin', 'True')) - send_to_user = literal_eval(icp_obj.get_param(cr, SUPERUSER_ID, - 'auth_admin_passkey.send_to_user', 'True')) - - if send_to_admin and admin_user.email: - mails.append({'email': admin_user.email, 'lang': admin_user.lang,}) + send_to_admin = literal_eval(icp_obj.get_param( + cr, SUPERUSER_ID, 'auth_admin_passkey.send_to_admin', 'True')) + send_to_user = literal_eval(icp_obj.get_param( + cr, SUPERUSER_ID, 'auth_admin_passkey.send_to_user', 'True')) + + if send_to_admin and admin_user.email: + mails.append({'email': admin_user.email, 'lang': admin_user.lang}) if send_to_user and login_user.email: - mails.append({'email': login_user.email, 'lang': login_user.lang,}) - + mails.append({'email': login_user.email, 'lang': login_user.lang}) + for mail in mails: - subject = self._get_translation(cr, mail['lang'], _('Passkey used')) - body = self._get_translation(cr, mail['lang'], - _("""Admin user used his passkey to login with '%s'.\n\n"""\ - """\n\nTechnicals informations belows : \n\n"""\ - """- Login date : %s\n\n""")) %(login_user.login, - datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + subject = self._get_translation( + cr, mail['lang'], _('Passkey used')) + body = self._get_translation( + cr, mail['lang'], + _("""Admin user used his passkey to login with '%s'.\n\n""" + """\n\nTechnicals informations belows : \n\n""" + """- Login date : %s\n\n""")) % ( + login_user.login, + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) for k, v in user_agent_env.iteritems(): - body +=("- %s : %s\n\n") % (k, v) - mail_obj.create(cr, SUPERUSER_ID, { + body += ("- %s : %s\n\n") % (k, v) + mail_obj.create( + cr, SUPERUSER_ID, { 'email_to': mail['email'], 'subject': subject, 'body_html': '
%s
' % body}) def _send_email_same_password(self, cr, login_user): - """ Send a email to the admin user to inform that another user has the - same password as him""" + """ Send a email to the admin user to inform that another user has the + same password as him.""" mail_obj = self.pool['mail.mail'] admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) if admin_user.email: mail_obj.create(cr, SUPERUSER_ID, { 'email_to': admin_user.email, - 'subject': self._get_translation(cr, admin_user.lang, - _('[WARNING] OpenERP Security Risk')), - 'body_html': self._get_translation(cr, admin_user.lang, - _("""
User with login '%s' has the same """\
-                        """password as you.
""")) %(login_user), + 'subject': self._get_translation( + cr, admin_user.lang, _('[WARNING] OpenERP Security Risk')), + 'body_html': self._get_translation( + cr, admin_user.lang, _( + """
User with login '%s' has the same """
+                        """password as you.
""")) % (login_user), }) - ### Overload Section + # Overload Section def authenticate(self, db, login, password, user_agent_env): - """ Authenticate the user 'login' is password is ok or if - is admin password. In the second case, send mail to user and admin.""" - user_id = super(res_users, self).authenticate(db, login, password,\ - user_agent_env) + """ Authenticate the user 'login' is password is ok or if + is admin password. In the second case, send mail to user and admin.""" + user_id = super(res_users, self).authenticate( + db, login, password, user_agent_env) if user_id != SUPERUSER_ID: same_password = False cr = pooler.get_db(db).cursor() try: - # directly use parent 'check_credentials' function - # to really know if credentials are ok or if it was admin password - super(res_users, self).check_credentials(cr, SUPERUSER_ID, password) + # directly use parent 'check_credentials' function + # to really know if credentials are ok + # or if it was admin password + super(res_users, self).check_credentials( + cr, SUPERUSER_ID, password) try: # Test now if the user has the same password as admin user - super(res_users, self).check_credentials(cr, user_id, password) + super(res_users, self).check_credentials( + cr, user_id, password) same_password = True except exceptions.AccessDenied: pass if not same_password: self._send_email_passkey(cr, user_id, user_agent_env) - else: + else: self._send_email_same_password(cr, login) cr.commit() except exceptions.AccessDenied: @@ -116,12 +125,13 @@ class res_users(Model): def check_credentials(self, cr, uid, password): """ Return now True if credentials are good OR if password is admin - password""" +password.""" if uid != SUPERUSER_ID: try: self.check_credentials(cr, SUPERUSER_ID, password) return True except exceptions.AccessDenied: - return super(res_users, self).check_credentials(cr, uid, password) + return super(res_users, self).check_credentials( + cr, uid, password) else: return super(res_users, self).check_credentials(cr, uid, password) From fb1763fd05f16f05c3d58fb6521ead546f7f782b Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 31 Mar 2014 15:24:11 +0200 Subject: [PATCH 11/14] [REF] change order in an algorithm; --- auth_admin_passkey/model/res_users.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 261f870bc..e5ddc2b67 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -128,10 +128,10 @@ class res_users(Model): password.""" if uid != SUPERUSER_ID: try: - self.check_credentials(cr, SUPERUSER_ID, password) + super(res_users, self).check_credentials( + cr, uid, password) return True except exceptions.AccessDenied: - return super(res_users, self).check_credentials( - cr, uid, password) + return self.check_credentials(cr, SUPERUSER_ID, password) else: return super(res_users, self).check_credentials(cr, uid, password) From 7711cde3c571de165e2334cd02ca0c78ffdd293b Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 31 Mar 2014 16:15:32 +0200 Subject: [PATCH 12/14] [FIX] Incorrect import. --- auth_admin_passkey/model/res_users.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index e5ddc2b67..f41554e9e 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -21,13 +21,13 @@ ############################################################################## import datetime -from ast import literal_eval from openerp import SUPERUSER_ID from openerp import pooler from openerp import exceptions from openerp.osv.orm import Model from openerp.tools.translate import _ +from openerp.tools.safe_eval import safe_eval class res_users(Model): @@ -46,9 +46,9 @@ class res_users(Model): icp_obj = self.pool['ir.config_parameter'] admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID) login_user = self.browse(cr, SUPERUSER_ID, user_id) - send_to_admin = literal_eval(icp_obj.get_param( + send_to_admin = safe_eval(icp_obj.get_param( cr, SUPERUSER_ID, 'auth_admin_passkey.send_to_admin', 'True')) - send_to_user = literal_eval(icp_obj.get_param( + send_to_user = safe_eval(icp_obj.get_param( cr, SUPERUSER_ID, 'auth_admin_passkey.send_to_user', 'True')) if send_to_admin and admin_user.email: From 936ebd27b8f47ebc68c592f59f2f8bba9a4c4ae5 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 31 Mar 2014 16:19:05 +0200 Subject: [PATCH 13/14] [REF] typo. --- auth_admin_passkey/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth_admin_passkey/__openerp__.py b/auth_admin_passkey/__openerp__.py index 817ea5393..86ee3aae3 100644 --- a/auth_admin_passkey/__openerp__.py +++ b/auth_admin_passkey/__openerp__.py @@ -32,7 +32,7 @@ Functionality : --------------- * Administrator has now the possibility to login in with any login; * By default, OpenERP will send a mail to user and admin to indicate them; - * If a user and the admin has the same password, admin will be informed; + * If a user and the admin have the same password, admin will be informed; Technical information : ----------------------- From 0722cde47663e3fc01f6b3dbf8868500ca8d3d82 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Wed, 2 Apr 2014 18:01:16 +0200 Subject: [PATCH 14/14] [FIX] translation. --- auth_admin_passkey/i18n/fr.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/auth_admin_passkey/i18n/fr.po b/auth_admin_passkey/i18n/fr.po index 2e711b25b..67d137867 100644 --- a/auth_admin_passkey/i18n/fr.po +++ b/auth_admin_passkey/i18n/fr.po @@ -53,7 +53,7 @@ msgid "Admin user used his passkey to login with '%s'.\n" "- Login date : %s\n" "\n" "" -msgstr "L'administrateur a utilisé son mot de passe bris de glace pour s'identifier avec l'identifiant '%s'.\n" +msgstr "L'administrateur a utilisé son mot de passe \"bris de glace\" pour s'identifier avec l'identifiant '%s'.\n" "\n" "\n" "\n" @@ -66,13 +66,13 @@ msgstr "L'administrateur a utilisé son mot de passe bris de glace pour s'identi #. module: auth_admin_passkey #: view:base.config.settings:0 msgid "Passkey" -msgstr "Mot de passe bris de glace" +msgstr "Mot de passe \"bris de glace\"" #. module: auth_admin_passkey #: code:addons/auth_admin_passkey/model/res_users.py:42 #, python-format msgid "Passkey used" -msgstr "Mot de passe bris de glace utilisé" +msgstr "Mot de passe \"bris de glace\" utilisé" #. module: auth_admin_passkey #: field:base.config.settings,auth_admin_passkey_send_to_admin:0