Show More
@@ -34,7 +34,13 b' class UserLog(Base):' | |||
|
34 | 34 | class Repository(Base): |
|
35 | 35 | __tablename__ = 'repositories' |
|
36 | 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 | 44 | class Permission(Base): |
|
39 | 45 | __tablename__ = 'permissions' |
|
40 | 46 | __table_args__ = {'useexisting':True} |
@@ -19,9 +19,9 b' list=[1,2,3,4,5]' | |||
|
19 | 19 | for SELECT use formencode.All(OneOf(list), Int()) |
|
20 | 20 | |
|
21 | 21 | """ |
|
22 | from formencode import All | |
|
22 | 23 | from formencode.validators import UnicodeString, OneOf, Int, Number, Regex, \ |
|
23 | 24 | Email, Bool, StringBoolean |
|
24 | from formencode import All | |
|
25 | 25 | from pylons import session |
|
26 | 26 | from pylons.i18n.translation import _ |
|
27 | 27 | from pylons_app.lib.auth import get_crypt_password |
@@ -30,6 +30,7 b' from pylons_app.model.db import User' | |||
|
30 | 30 | from sqlalchemy.exc import OperationalError |
|
31 | 31 | from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound |
|
32 | 32 | from webhelpers.pylonslib.secure_form import authentication_token |
|
33 | import datetime | |
|
33 | 34 | import formencode |
|
34 | 35 | import logging |
|
35 | 36 | log = logging.getLogger(__name__) |
@@ -95,6 +96,15 b' class ValidAuth(formencode.validators.Fa' | |||
|
95 | 96 | session['hg_app_user'] = auth_user |
|
96 | 97 | session.save() |
|
97 | 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 | 108 | return value |
|
99 | 109 | else: |
|
100 | 110 | log.warning('user %s not authenticated', username) |
General Comments 0
You need to be logged in to leave comments.
Login now