Switch to unified view

a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
...
...
12
from datetime import datetime
12
from datetime import datetime
13
13
14
import ldap
14
import ldap
15
from ldap import modlist
15
from ldap import modlist
16
import pkg_resources
16
import pkg_resources
17
from tg import config
17
from tg import config, flash
18
from pylons import g, c
18
from pylons import g, c
19
from webob import exc
19
from webob import exc
20
20
21
from ming.utils import LazyProperty
21
from ming.utils import LazyProperty
22
from ming.orm import session
22
from ming.orm import session
...
...
88
88
89
class LocalAuthenticationProvider(AuthenticationProvider):
89
class LocalAuthenticationProvider(AuthenticationProvider):
90
90
91
    def register_user(self, user_doc):
91
    def register_user(self, user_doc):
92
        from allura import model as M
92
        from allura import model as M
93
        return M.User(**user_doc)
93
        u = M.User(**user_doc)
94
        if 'password' in user_doc:
95
            u.set_password(user_doc['password'])
96
        return u
94
97
95
    def _login(self):
98
    def _login(self):
96
        user = self.by_username(self.request.params['username'])
99
        user = self.by_username(self.request.params['username'])
97
        if not self._validate_password(user, self.request.params['password']):
100
        if not self._validate_password(user, self.request.params['password']):
98
            raise exc.HTTPUnauthorized()
101
            raise exc.HTTPUnauthorized()