Accepting request 423956 from Application:ERP:Tryton:Factory

part of GNU Health

OBS-URL: https://build.opensuse.org/request/show/423956
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/trytond?expand=0&rev=1
This commit is contained in:
Dominique Leuenberger 2016-09-23 09:30:47 +00:00 committed by Git OBS Bridge
commit e7be6ce126
12 changed files with 820 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

4
_service Normal file
View File

@ -0,0 +1,4 @@
<services>
<service name="download_files" mode="localonly"/>
</services>

220
tryton-server.README.SUSE Normal file
View File

@ -0,0 +1,220 @@
tryton-server for openSUSE
==========================
Setup
=====
Preparing the database
----------------------
Tryton uses a Relational Database Management System (RDBMS) to store data. The
preferred RDBMS for Tryton is PostgreSQL.
You have to setup this database manually. Here is a short explanation how to
achieve this.
We can distinguish two scenarios, to which the following description will reference:
1) the database is created manually (recommended for productive environments)
2) the database shall be created from the Tryton client (recommended for test)
* In both cases, make sure PostgreSQL is running:
# systemctl status postgresql
Note: If PostgreSQL runs on another machine than the Tryton server, make sure
you have setup database password authentication. Please refer to the
PostgreSQL manual how to do this. If they run on the same machine, connection
via local sockets is preferred and you are done with the default configuration
of the PostgreSQL package.
If postgres runs locally, you may need to change the configuration file
/var/lib/pgsql/data/pg_hba.conf the line
local all all md5
to
local all all trust
Restart the server for the changes to take effect.
* Creating the database user:
The Tryton Server runs as user 'tryton', so we need a role in postgres for this.
Case 1)
For manual database creation it is sufficient to create the user as follows:
su postgres
psql -c "CREATE USER tryton WITH CREATEDB;"
Case 2)
In case 2 the user needs additionally an encrypted password::
su postgres
psql -c "ALTER ROLE tryton ENCRYPTED PASSWORD 'tryton_password' ;"
Note: If you want to run the database as another user than 'tryton', you
need to replace 'tryton' above with the user you want to use instead.
Preparing the Tryton server
---------------------------
* Setting up the Tryton server (trytond):
The openSUSE package comes with a working configuration example, see
/usr/share/doc/packages/trytond/trytond.conf.example
It contains all settings for a locally running database and manual database
configuration.
Adjust /etc/tryton/trytond.conf to reflect the setup of your system by using
the database user and password from step 1 for the database URI.
For case 1 you do not need to do anything additional.
For case 2 (creation of database from Tryton frontend) you need to set the
Super password in the configuration file.
See section super_pwd in
http://trytond.readthedocs.org/en/latest/topics/configuration.html
As a result you will get an encypted password in the form
super_pwd = grlvvq5T4r5BQ
which is entered in /etc/tryton/trytond.conf
* If the Tryton server shall listen on some external interface (i.e. shall be
available for clients connecting from other machines), change the jsonrpc
protocol to listen accordingly.
* If the Tryton server is listening on external interfaces, it is highly
recommended to enable SSL for the connection.
Note: See https://code.google.com/p/tryton/wiki/InstallationonopenSUSE#Setting_up_SSL_communication_with_the_Tryton_server
for a description to set up certificates
* Restarting trytond:
# systemctl restart trytond
Note: The fingerprint of connected servers is stored in the clients
known_hosts file. When a server is changed for its SSL usage, the client
will refuse to reconnect to this server. Removing the according line
from ~/.config/tryton/<version>/known_hosts will allow to connect to
the server again.
Now you are ready to connect with a client, e.g. tryton-client.
Creating the database for Tryton
--------------------------------
For case 1, manual creation of the database, the folowing steps are to be performed:
* Creating the database:
# su - postgres -c "createdb mydb --encoding='UTF-8' --owner=tryton"
Note: The owner of the database should be the same user, as under which the
tryton server runs (default:tryton) Enter a name for the database
(here as default: mydb).
* Initializing the database:
# /usr/bin/trytond -c /etc/tryton/trytond.conf --all -d mydb
Note: Use the database name you chose in the previous step (here as default:
mydb). You will be asked for the admin password for this database.
As result you will have a bare Tryton database with the base modules installed.
For case 2, you need to create an encrypted password and enter it in the
configuration file as super_pwd
See: http://doc.tryton.org/3.8/trytond/doc/topics/configuration.html
Installation of the Webfrontend for tryton (sao) from package
-------------------------------------------------------------
For most openSUSE Flavours tryton-sao is packed. You can install it with
zypper install tryton-sao
You need to edit /etc/tryton/trytond.conf. Installation of tryton-sao follows the
standards for nodejs-installations, so the path is within the node-modules:
In the section [jsonrpc], set the data path:
data = /usr/lib/node-modules/tryton-sao
Now restart trytond.
Installation of the Webfrontend for tryton (sao) from source
------------------------------------------------------------
In case you want to install sao from source:
sao bases on nodejs, and it comes as separate package. Download and extract
tryton-sao into a directory, say /srv/tryton-sao
Make sure you have nodejs and git installed:
zypper install nodejs git
Now change into to installation directory and install sao:
cd /srv/tryton-sao/package
npm install
Now you need to run grunt. make sure it is run from the locally installed version:
cd /srv/tryton-sao/package
node_modules/grunt-cli/bin/grunt
Last but not least, edit /etc/tryton/trytond.conf
In the section [jsonrpc], set the data path:
data = /srv/tryton-sao/package
Now restart trytond.
Upgrade
-------
* Once you have upgraded to a new major version (second number of the
version string) you have to update your database(s).
After the categorically recommended backup do:
# /usr/bin/trytond -c /etc/tryton/trytond.conf --all -d mydb
Remember to replace tryton with the name of your database.
Notes
-----
Now, you're finished with the system setup. Please be aware of the following things:
* trytond runs by default under the user 'tryton', who is setup as no-login.
If you need to login as user tryton, use su - tryton -s /bin/bash
* trytond has one default account for server administration:
- User: admin; password: the one you have configured in trytond.conf
as super_pwd. This user is the one used for database management tasks
from the client.
Note: Each Tryton database will have its own admin with login password
stored in the database itself (not to be confound with the admin of the
Tryton Server).
* trytond must have read access to its configuration file, otherwise it will
start with internal defaults. The postinst script will (re)set ownership to
the system user running trytond and correct the permissions on the standard
configuration file (/etc/tryton/trytond.conf).
* trytond listens by default on port 8000 (jsonrpc). If you need to change
this, edit /etc/tryton/trytond.conf in the section [jsonrpc].
* trytond in its upstream configuration listens by default to the localhost
interface. If you want to change this default to listen on all interfaces,
edit /etc/tryton/trytond.conf in the section [jsonrpc].
* modules can be installed via YaST or zypper, e.g. zypper in trytond_account
* Installation of modules into the database can be done from the
Administration Panel of the client. Under Modules you can select from the
modules packages (trytond_*) you have installed on your system.
* Only the same major version of Tryton client and Tryton server can connect.
-- Axel Braun <axel.braun@gmx.de> Tue, 17 Jan 2016

3
trytond-3.8.8.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6ba8596bbb3b86fd5cd4087dda0087fa11255195ea3565f0ecf8390251d61e6d
size 579694

92
trytond.changes Normal file
View File

@ -0,0 +1,92 @@
-------------------------------------------------------------------
Wed Aug 31 06:15:53 UTC 2016 - axel.braun@gmx.de
- Version 3.8.8
-------------------------------------------------------------------
Wed Aug 24 15:01:13 UTC 2016 - axel.braun@gmx.de
- License added to package documentation
-------------------------------------------------------------------
Wed Aug 24 11:27:00 UTC 2016 - jengelh@inai.de
- Update description
- Add missing %service_add_pre and convert open-coded other
three scriptlets to %service_*.
-------------------------------------------------------------------
Tue Jul 5 09:43:38 UTC 2016 - axel.braun@gmx.de
- version 3.8.6
-------------------------------------------------------------------
Thu Jun 30 13:34:19 UTC 2016 - axel.braun@gmx.de
- changed requirement to python-python-sql
-------------------------------------------------------------------
Mon Mar 28 11:58:39 UTC 2016 - axel.braun@gmx.de
- patch for security vulnerability applied, see
https://savannah.gnu.org/forum/forum.php?forum_id=8482
-------------------------------------------------------------------
Sun Jan 17 12:48:36 UTC 2016 - axel.braun@gmx.de
- Installation of sao (webfrontend) documented
-------------------------------------------------------------------
Wed Oct 19 20:14:38 UTC 2015 - axel.braun@gmx.de
- Tryton Release 3.8
-------------------------------------------------------------------
Wed May 27 08:27:18 UTC 2015 - axel.braun@gmx.de
- version 3.6.1
* clean up of specfile
-------------------------------------------------------------------
Wed Apr 15 07:24:15 UTC 2015 - axel.braun@gmx.de
- Tryton Release 3.6
-------------------------------------------------------------------
Sat Feb 28 11:48:03 UTC 2015 - axel.braun@gmx.de
- sample file for confirguration added (trytond.conf.example)
tryton-server.README.SUSE updated
-------------------------------------------------------------------
Fri Nov 14 15:52:52 UTC 2014 - axel.braun@gmx.de
- systemd startup file corrected, sample file for log config added
-------------------------------------------------------------------
Tue Nov 4 10:24:39 UTC 2014 - axel.braun@gmx.de
- added trytond.conf
-------------------------------------------------------------------
Sun Nov 2 20:38:21 UTC 2014 - axel.braun@gmx.de
- version 3.4
-------------------------------------------------------------------
Wed Oct 23 14:59:59 UTC 2013 - axel.braun@gmx.de
- new branch 3.0, added python-sql
-------------------------------------------------------------------
Tue Oct 22 18:01:29 UTC 2013 - axel.braun@gmx.de
- Tryton 3.0, spec file adapted
* Sat Jun 22 2013 axel.braun@gmx.de
- new spec with regard to systemd
- setup of user tryton if not existing
* Sun Mar 29 2009 axel.braun@gmx.de
- packaged tryton version 1.0.3 using the buildservice spec file wizard

134
trytond.conf Normal file
View File

@ -0,0 +1,134 @@
# /etc/tryton/trytond.conf - Configuration file for Tryton Server (trytond)
#
# This file contains the most common settings for trytond (Defaults
# are commented).
# For more information read
# /usr/share/doc/packages/trytond
[database]
# Database related settings
# The URI to connect to the SQL database (following RFC-3986)
# uri = database://username:password@host:port/
# (Internal default: sqlite:// (i.e. a local SQLite database))
#
# PostgreSQL via Unix domain sockets
# (e.g. PostgreSQL database running on the same machine (localhost))
#uri = postgresql://tryton:tryton@/
#
# Postgres running on the same machine:
uri = postgresql:///
#
#
# PostgreSQL via TCP/IP
# (e.g. connecting to a PostgreSQL database running on a remote machine or
# by means of md5 authentication. Needs PostgreSQL to be configured to accept
# those connections (pg_hba.conf).)
#uri = postgresql://tryton:tryton@localhost:5432/
# The path to the directory where the Tryton Server stores files.
# The server must have write permissions to this directory.
# (Internal default: /var/lib/trytond)
path = /var/lib/tryton
# Shall available databases be listed in the client?
#list = True
# The number of retries of the Tryton Server when there are errors
# in a request to the database
#retry = 5
# The primary language, that is used to store entries in translatable
# fields into the database.
#language = en_US
[ssl]
# SSL settings
# Activation of SSL for all available protocols.
# Uncomment the following settings for key and certificate
# to enable SSL.
# The path to the private key
#privatekey = /etc/ssl/private/ssl-cert-snakeoil.key
# The path to the certificate
#certificate = /etc/ssl/certs/ssl-cert-snakeoil.pem
[jsonrpc]
# Settings for the JSON-RPC network interface
# The IP/host and port number of the interface
# (Internal default: localhost:8000)
#
# Listen on all interfaces (IPv4)
#listen = 0.0.0.0:8000
#
# Listen on all interfaces (IPv4 and IPv6)
#listen = [::]:8000
# The hostname for this interface
#hostname =
# The root path to retrieve data for GET requests
#data = jsondata
[xmlrpc]
# Settings for the XML-RPC network interface
# The IP/host and port number of the interface
#listen = localhost:8069
[webdav]
# Settings for the WebDAV network interface
# The IP/host and port number of the interface
#listen = localhost:8080
[session]
# Session settings
# The time (in seconds) until an inactive session expires
#timeout = 3600
# The server administration password used by the client for
# the execution of database management tasks. It is encrypted
# using using the Unix crypt(3) routine. A password can be
# generated using the following command line (on one line):
# $ python -c 'import getpass,crypt,random,string; \
# print crypt.crypt(getpass.getpass(), \
# "".join(random.sample(string.ascii_letters + string.digits, 8)))'
# Example password with 'admin'
#super_pwd = jkUbZGvFNeugk
[email]
# Mail settings
# The URI to connect to the SMTP server.
# Available protocols are:
# - smtp: simple SMTP
# - smtp+tls: SMTP with STARTTLS
# - smtps: SMTP with SSL
#uri = smtp://localhost:25
# The From address used by the Tryton Server to send emails.
#from = tryton@localhost
[report]
# Report settings
# Unoconv parameters for connection to the unoconv service.
#unoconv = pipe,name=trytond;urp;StarOffice.ComponentContext
# Module settings
#
# Some modules are reading configuration parameters from this
# configuration file. These settings only apply when those modules
# are installed.
#
#[ldap_authentication]
# The URI to connect to the LDAP server.
#uri = ldap://host:port/dn?attributes?scope?filter?extensions
# A basic default URL could look like
#uri = ldap://localhost:389/

135
trytond.conf.example Normal file
View File

@ -0,0 +1,135 @@
# /etc/tryton/trytond.conf - Configuration file for Tryton Server (trytond)
#
# This file contains the most common settings for trytond (Defaults
# are commented).
# For more information read
# /usr/share/doc/packages/trytond
[database]
# Database related settings
# The URI to connect to the SQL database (following RFC-3986)
# uri = database://username:password@host:port/
# (Internal default: sqlite:// (i.e. a local SQLite database))
#
# PostgreSQL via Unix domain sockets
# (e.g. PostgreSQL database running on the same machine (localhost))
#uri = postgresql://tryton:tryton@/
#
#Default setting for a local postgres database
uri = postgresql:///
#
# PostgreSQL via TCP/IP
# (e.g. connecting to a PostgreSQL database running on a remote machine or
# by means of md5 authentication. Needs PostgreSQL to be configured to accept
# those connections (pg_hba.conf).)
#uri = postgresql://tryton:tryton@localhost:5432/
# The path to the directory where the Tryton Server stores files.
# The server must have write permissions to this directory.
# (Internal default: /var/lib/trytond)
path = /var/lib/tryton
# Shall available databases be listed in the client?
#list = True
# The number of retries of the Tryton Server when there are errors
# in a request to the database
#retry = 5
# The primary language, that is used to store entries in translatable
# fields into the database.
#language = en_US
[ssl]
# SSL settings
# Activation of SSL for all available protocols.
# Uncomment the following settings for key and certificate
# to enable SSL.
# The path to the private key
#privatekey = /etc/ssl/private/ssl-cert-snakeoil.key
# The path to the certificate
#certificate = /etc/ssl/certs/ssl-cert-snakeoil.pem
[jsonrpc]
# Settings for the JSON-RPC network interface
# The IP/host and port number of the interface
# (Internal default: localhost:8000)
#
# Listen on all interfaces (IPv4)
listen = 0.0.0.0:8000
#
# Listen on all interfaces (IPv4 and IPv6)
#listen = [::]:8000
# The hostname for this interface
#hostname =
# The root path to retrieve data for GET requests
#data = jsondata
[xmlrpc]
# Settings for the XML-RPC network interface
# The IP/host and port number of the interface
#listen = localhost:8069
[webdav]
# Settings for the WebDAV network interface
# The IP/host and port number of the interface
#listen = localhost:8080
[session]
# Session settings
# The time (in seconds) until an inactive session expires
#timeout = 3600
# The server administration password used by the client for
# the execution of database management tasks. It is encrypted
# using using the Unix crypt(3) routine. A password can be
# generated using the following command line (on one line):
# $ python -c 'import getpass,crypt,random,string; \
# print crypt.crypt(getpass.getpass(), \
# "".join(random.sample(string.ascii_letters + string.digits, 8)))'
# Example password with 'admin'
#super_pwd = jkUbZGvFNeugk
[email]
# Mail settings
# The URI to connect to the SMTP server.
# Available protocols are:
# - smtp: simple SMTP
# - smtp+tls: SMTP with STARTTLS
# - smtps: SMTP with SSL
#uri = smtp://localhost:25
# The From address used by the Tryton Server to send emails.
#from = tryton@localhost
[report]
# Report settings
# Unoconv parameters for connection to the unoconv service.
#unoconv = pipe,name=trytond;urp;StarOffice.ComponentContext
# Module settings
#
# Some modules are reading configuration parameters from this
# configuration file. These settings only apply when those modules
# are installed.
#
#[ldap_authentication]
# The URI to connect to the LDAP server.
#uri = ldap://host:port/dn?attributes?scope?filter?extensions
# A basic default URL could look like
#uri = ldap://localhost:389/

20
trytond.service Normal file
View File

@ -0,0 +1,20 @@
[Unit]
Description=Tryton server
After=syslog.target
[Service]
Type=simple
User=tryton
Group=tryton
PIDFile=/var/lib/trytond/trytond.pid
ExecStart=/usr/bin/trytond --config /etc/tryton/trytond.conf --pidfile=/var/lib/tryton/trytond.pid --logconf=/etc/tryton/trytond_log.conf
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300
# We rely on systemd to restart trytond if it dies
Restart=always
[Install]
WantedBy=multi-user.target

128
trytond.spec Normal file
View File

@ -0,0 +1,128 @@
#
# spec file for package trytond
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 Dr. Axel Braun
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define majorver 3.8
%define base_name tryton
Name: trytond
Version: %{majorver}.8
Release: 0
Summary: An Enterprise Resource Planning system
License: GPL-3.0+
Group: Productivity/Office/Management
Url: http://www.tryton.org/
Source0: http://downloads.tryton.org/%{majorver}/%{name}-%{version}.tar.gz
Source1: tryton-server.README.SUSE
Source2: trytond.conf.example
Source3: %{name}.conf
Source4: %{name}_log.conf
#Source11: %{name}.sysconfig
Source20: %{name}.service
Patch0: %{name}_server.diff
# List of additional build dependencies
BuildRequires: fdupes
BuildRequires: python-devel
BuildRequires: python-lxml
BuildRequires: python-psycopg2
BuildRequires: python-pydot
BuildRequires: python-python-sql
BuildRequires: python-setuptools
BuildRequires: python-simplejson
BuildRequires: systemd-rpm-macros
Requires: libreoffice-pyuno
Requires: postgresql-server
Requires: python-Genshi
Requires: python-Levenshtein
Requires: python-PyWebDAV
Requires: python-Sphinx
Requires: python-cdecimal
Requires: python-lxml
Requires: python-mock
Requires: python-polib
Requires: python-psycopg2
Requires: python-py-bcrypt
#Requires: python-pytz
#Requires: python-pyOpenSSL
#Requires: python-egenix-mx-base
Requires: python-python-dateutil
Requires: python-python-sql
Requires: python-relatorio
Requires: unoconv
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%{?systemd_requires}
%description
This package contains the server of the Tryton application platform,
the latter of which is a three-tier high-level general purpose
application platform written in Python, using Postgresql as the
database engine. Tryton provides modularity, scalability and
security.
%prep
%setup -q
cp %{SOURCE1} .
cp %{SOURCE2} .
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} --record-rpm=filelist
# only for systemd
mkdir -p %{buildroot}%{_sysconfdir}/%{base_name}
install -p -m 640 %{SOURCE3} %{buildroot}%{_sysconfdir}/%{base_name}/%{name}.conf
install -p -m 640 %{SOURCE4} %{buildroot}%{_sysconfdir}/%{base_name}/%{name}_log.conf
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 %{SOURCE20} %{buildroot}%{_unitdir}/%{name}.service
mkdir -p %{buildroot}%{_localstatedir}/{lib,log}/%{base_name}
%fdupes -s %{buildroot}
%pre
getent group tryton > /dev/null || %{_sbindir}/groupadd -r tryton || :
getent passwd tryton > /dev/null || %{_sbindir}/useradd -r -g tryton \
-d %{_localstatedir}/lib/%{name} -s /sbin/nologin \
-c 'Tryton ERP' tryton || :
%service_add_pre trytond.service
%post
%service_add_post trytond.service
%preun
%service_del_preun trytond.service
%postun
%service_del_postun trytond.service
%files
%defattr(-,root,root)
%doc README tryton-server.README.SUSE trytond.conf.example LICENSE doc/*
%{python_sitelib}/*
%dir %{_sysconfdir}/%{base_name}
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
%attr(640,root,tryton) %config(noreplace)%{_sysconfdir}/%{base_name}/%{name}.conf
%attr(640,root,tryton) %config(noreplace)%{_sysconfdir}/%{base_name}/%{name}_log.conf
%attr(755,tryton,tryton) %dir %{_localstatedir}/lib/%{base_name}
%attr(755,tryton,tryton) %dir %{_localstatedir}/log/%{base_name}
%changelog

27
trytond_log.conf Normal file
View File

@ -0,0 +1,27 @@
# /etc/tryton/trytond_log.conf - Logging configuration file for Tryton Server (trytond)
#
# This file contains settings for trytond to rotate logs daily and
# to keep 30 logs.
[database]
[formatters]
keys: simple
[handlers]
keys: rotate
[loggers]
keys: root
[formatter_simple]
format: %(asctime)s] %(levelname)s:%(name)s:%(message)s
datefmt: %a %b %d %H:%M:%S %Y
[handler_rotate]
class: handlers.TimedRotatingFileHandler
args: ('/var/log/tryton/trytond.log', 'D', 1, 30)
formatter: simple
[logger_root]
level: INFO
handlers: rotate

33
trytond_server.diff Normal file
View File

@ -0,0 +1,33 @@
diff -crB a/trytond/res/user.py b/trytond/res/user.py
*** a/trytond/res/user.py 2016-03-08 13:56:41.921761645 +0000
- --- b/trytond/res/user.py 2016-03-08 13:57:05.931762976 +0000
***************
*** 464,476 ****
Return user id if password matches
'''
LoginAttempt = Pool().get('res.user.login.attempt')
- - time.sleep(2 ** LoginAttempt.count(login) - 1)
user_id, password_hash = cls._get_login(login)
if user_id:
if cls.check_password(password, password_hash):
- - LoginAttempt.remove(login)
return user_id
! LoginAttempt.add(login)
return 0
@staticmethod
- --- 464,477 ----
Return user id if password matches
'''
LoginAttempt = Pool().get('res.user.login.attempt')
user_id, password_hash = cls._get_login(login)
if user_id:
if cls.check_password(password, password_hash):
return user_id
!
! #Timeout for invalid login attempts
! #TODO : use failed_login_timeout from configuration param.
! time.sleep(3)
return 0
@staticmethod