##// END OF EJS Templates
users: change last activity to re-use new column.
marcink -
r1546:b45c2eaa default
parent child Browse files
Show More
@@ -137,8 +137,7 b' class AdminUsersView(BaseAppView):'
137 "first_name": h.escape(user.name),
137 "first_name": h.escape(user.name),
138 "last_name": h.escape(user.lastname),
138 "last_name": h.escape(user.lastname),
139 "last_login": h.format_date(user.last_login),
139 "last_login": h.format_date(user.last_login),
140 "last_activity": h.format_date(
140 "last_activity": h.format_date(user.last_activity),
141 h.time_to_datetime(user.user_data.get('last_activity', 0))),
142 "active": h.bool2icon(user.active),
141 "active": h.bool2icon(user.active),
143 "active_raw": user.active,
142 "active_raw": user.active,
144 "admin": h.bool2icon(user.admin),
143 "admin": h.bool2icon(user.admin),
@@ -846,12 +846,9 b' class User(Base, BaseModel):'
846
846
847 def update_lastactivity(self):
847 def update_lastactivity(self):
848 """Update user lastactivity"""
848 """Update user lastactivity"""
849 usr = self
849 self.last_activity = datetime.datetime.now()
850 old = usr.user_data
850 Session().add(self)
851 old.update({'last_activity': time.time()})
851 log.debug('updated user %s lastactivity', self.username)
852 usr.user_data = old
853 Session().add(usr)
854 log.debug('updated user %s lastactivity', usr.username)
855
852
856 def update_password(self, new_password):
853 def update_password(self, new_password):
857 from rhodecode.lib.auth import get_crypt_password
854 from rhodecode.lib.auth import get_crypt_password
@@ -6,7 +6,7 b''
6 (_('Source of Record'), c.user.extern_type, '', ''),
6 (_('Source of Record'), c.user.extern_type, '', ''),
7
7
8 (_('Last login'), c.user.last_login or '-', '', ''),
8 (_('Last login'), c.user.last_login or '-', '', ''),
9 (_('Last activity'), h.format_date(h.time_to_datetime(c.user.user_data.get('last_activity', 0))), '', ''),
9 (_('Last activity'), c.user.last_activity, '', ''),
10
10
11 (_('Repositories'), len(c.user.repositories), '', [x.repo_name for x in c.user.repositories]),
11 (_('Repositories'), len(c.user.repositories), '', [x.repo_name for x in c.user.repositories]),
12 (_('Repository groups'), len(c.user.repository_groups), '', [x.group_name for x in c.user.repository_groups]),
12 (_('Repository groups'), len(c.user.repository_groups), '', [x.group_name for x in c.user.repository_groups]),
General Comments 0
You need to be logged in to leave comments. Login now