Rushabh Mehta | ad45e31 | 2013-11-20 12:59:58 +0530 | [diff] [blame] | 1 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors |
Rushabh Mehta | e67d1fb | 2013-08-05 14:59:54 +0530 | [diff] [blame] | 2 | # License: GNU General Public License v3. See license.txt" |
Rushabh Mehta | ce1d527 | 2013-01-09 16:39:27 +0530 | [diff] [blame] | 3 | |
Rushabh Mehta | 3966f1d | 2012-02-23 12:35:32 +0530 | [diff] [blame] | 4 | |
Anand Doshi | 486f9df | 2012-07-19 13:40:31 +0530 | [diff] [blame] | 5 | from __future__ import unicode_literals |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 6 | import webnotes |
Rushabh Mehta | 6de403f | 2013-12-13 14:10:14 +0530 | [diff] [blame] | 7 | |
Rushabh Mehta | c652a62 | 2013-12-16 12:48:22 +0530 | [diff] [blame] | 8 | def on_session_creation(login_manager): |
Rushabh Mehta | bedc1fe | 2012-01-17 18:17:06 +0530 | [diff] [blame] | 9 | """ |
| 10 | called after login |
| 11 | update login_from and delete parallel sessions |
| 12 | """ |
Rushabh Mehta | 3f7e272 | 2014-01-01 10:43:05 +0530 | [diff] [blame] | 13 | if webnotes.session['user'] not in ('Guest'): |
Rushabh Mehta | 63d669f | 2012-02-03 12:56:12 +0530 | [diff] [blame] | 14 | # create feed |
| 15 | from webnotes.utils import nowtime |
Rushabh Mehta | 91ba346 | 2012-07-13 14:54:40 +0530 | [diff] [blame] | 16 | from webnotes.profile import get_user_fullname |
Rushabh Mehta | 028abd2 | 2013-01-31 11:20:10 +0530 | [diff] [blame] | 17 | webnotes.conn.begin() |
Rushabh Mehta | 6de403f | 2013-12-13 14:10:14 +0530 | [diff] [blame] | 18 | make_feed('Login', 'Profile', login_manager.user, login_manager.user, |
Anand Doshi | aea8204 | 2012-10-15 15:30:56 +0530 | [diff] [blame] | 19 | '%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()), |
Rushabh Mehta | 028abd2 | 2013-01-31 11:20:10 +0530 | [diff] [blame] | 20 | login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D') |
Rushabh Mehta | 3f7e272 | 2014-01-01 10:43:05 +0530 | [diff] [blame] | 21 | webnotes.conn.commit() |