Show More
@@ -34,7 +34,13 b' class UserLog(Base):' | |||||
34 | class Repository(Base): |
|
34 | class Repository(Base): | |
35 | __tablename__ = 'repositories' |
|
35 | __tablename__ = 'repositories' | |
36 | repo_id = Column("repo_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=1) |
|
36 | repo_id = Column("repo_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=1) | |
37 |
|
37 | repo_name = Column("repo_name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | ||
|
38 | user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=True, unique=None, default=None) | |||
|
39 | private = Column("private", BOOLEAN(), nullable=True, unique=None, default=None) | |||
|
40 | ||||
|
41 | user = relation('User') | |||
|
42 | ||||
|
43 | ||||
38 | class Permission(Base): |
|
44 | class Permission(Base): | |
39 | __tablename__ = 'permissions' |
|
45 | __tablename__ = 'permissions' | |
40 | __table_args__ = {'useexisting':True} |
|
46 | __table_args__ = {'useexisting':True} |
@@ -19,9 +19,9 b' list=[1,2,3,4,5]' | |||||
19 | for SELECT use formencode.All(OneOf(list), Int()) |
|
19 | for SELECT use formencode.All(OneOf(list), Int()) | |
20 |
|
20 | |||
21 | """ |
|
21 | """ | |
|
22 | from formencode import All | |||
22 | from formencode.validators import UnicodeString, OneOf, Int, Number, Regex, \ |
|
23 | from formencode.validators import UnicodeString, OneOf, Int, Number, Regex, \ | |
23 | Email, Bool, StringBoolean |
|
24 | Email, Bool, StringBoolean | |
24 | from formencode import All |
|
|||
25 | from pylons import session |
|
25 | from pylons import session | |
26 | from pylons.i18n.translation import _ |
|
26 | from pylons.i18n.translation import _ | |
27 | from pylons_app.lib.auth import get_crypt_password |
|
27 | from pylons_app.lib.auth import get_crypt_password | |
@@ -30,6 +30,7 b' from pylons_app.model.db import User' | |||||
30 | from sqlalchemy.exc import OperationalError |
|
30 | from sqlalchemy.exc import OperationalError | |
31 | from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound |
|
31 | from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound | |
32 | from webhelpers.pylonslib.secure_form import authentication_token |
|
32 | from webhelpers.pylonslib.secure_form import authentication_token | |
|
33 | import datetime | |||
33 | import formencode |
|
34 | import formencode | |
34 | import logging |
|
35 | import logging | |
35 | log = logging.getLogger(__name__) |
|
36 | log = logging.getLogger(__name__) | |
@@ -95,6 +96,15 b' class ValidAuth(formencode.validators.Fa' | |||||
95 | session['hg_app_user'] = auth_user |
|
96 | session['hg_app_user'] = auth_user | |
96 | session.save() |
|
97 | session.save() | |
97 | log.info('user %s is now authenticated', username) |
|
98 | log.info('user %s is now authenticated', username) | |
|
99 | ||||
|
100 | try: | |||
|
101 | user.last_login = datetime.datetime.now() | |||
|
102 | sa.add(user) | |||
|
103 | sa.commit() | |||
|
104 | except (OperationalError) as e: | |||
|
105 | log.error(e) | |||
|
106 | sa.rollback() | |||
|
107 | ||||
98 | return value |
|
108 | return value | |
99 | else: |
|
109 | else: | |
100 | log.warning('user %s not authenticated', username) |
|
110 | log.warning('user %s not authenticated', username) |
General Comments 0
You need to be logged in to leave comments.
Login now