equal
deleted
inserted
replaced
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """Define server side service provided by cubicweb""" |
18 """Define server side service provided by cubicweb""" |
19 |
19 |
20 import threading |
20 import threading |
21 |
|
22 from six import text_type |
|
23 |
21 |
24 from cubicweb.server import Service |
22 from cubicweb.server import Service |
25 from cubicweb.predicates import match_user_groups, match_kwargs |
23 from cubicweb.predicates import match_user_groups, match_kwargs |
26 |
24 |
27 |
25 |
109 __select__ = Service.__select__ & match_kwargs('login', 'password') |
107 __select__ = Service.__select__ & match_kwargs('login', 'password') |
110 default_groups = ('users',) |
108 default_groups = ('users',) |
111 |
109 |
112 def call(self, login, password, email=None, groups=None, **cwuserkwargs): |
110 def call(self, login, password, email=None, groups=None, **cwuserkwargs): |
113 cnx = self._cw |
111 cnx = self._cw |
114 if isinstance(password, text_type): |
112 if isinstance(password, str): |
115 # password should *always* be utf8 encoded |
113 # password should *always* be utf8 encoded |
116 password = password.encode('UTF8') |
114 password = password.encode('UTF8') |
117 cwuserkwargs['login'] = login |
115 cwuserkwargs['login'] = login |
118 cwuserkwargs['upassword'] = password |
116 cwuserkwargs['upassword'] = password |
119 # we have to create the user |
117 # we have to create the user |