removed demo hooks
This commit is contained in:
parent
2511aa2b14
commit
3f7e2729bb
@ -10,16 +10,7 @@ def on_session_creation(login_manager):
|
|||||||
called after login
|
called after login
|
||||||
update login_from and delete parallel sessions
|
update login_from and delete parallel sessions
|
||||||
"""
|
"""
|
||||||
# Clear previous sessions i.e. logout previous log-in attempts
|
if webnotes.session['user'] not in ('Guest'):
|
||||||
allow_multiple_sessions = ['demo@erpnext.com', 'Administrator', 'Guest']
|
|
||||||
if webnotes.session['user'] not in allow_multiple_sessions:
|
|
||||||
from webnotes.sessions import clear_sessions
|
|
||||||
clear_sessions(webnotes.session.user, keep_current=True)
|
|
||||||
|
|
||||||
# check if account is expired
|
|
||||||
check_if_expired()
|
|
||||||
|
|
||||||
if webnotes.session['user'] not in ('Guest', 'demo@erpnext.com'):
|
|
||||||
# create feed
|
# create feed
|
||||||
from webnotes.utils import nowtime
|
from webnotes.utils import nowtime
|
||||||
from webnotes.profile import get_user_fullname
|
from webnotes.profile import get_user_fullname
|
||||||
@ -28,30 +19,3 @@ def on_session_creation(login_manager):
|
|||||||
'%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()),
|
'%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()),
|
||||||
login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D')
|
login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D')
|
||||||
webnotes.conn.commit()
|
webnotes.conn.commit()
|
||||||
|
|
||||||
def check_if_expired():
|
|
||||||
"""check if account is expired. If expired, do not allow login"""
|
|
||||||
from webnotes import conf
|
|
||||||
# check if expires_on is specified
|
|
||||||
if not 'expires_on' in conf: return
|
|
||||||
|
|
||||||
# check if expired
|
|
||||||
from datetime import datetime, date
|
|
||||||
expires_on = datetime.strptime(conf.expires_on, '%Y-%m-%d').date()
|
|
||||||
if date.today() <= expires_on: return
|
|
||||||
|
|
||||||
# if expired, stop user from logging in
|
|
||||||
from webnotes.utils import formatdate
|
|
||||||
msg = """Oops! Your subscription expired on <b>%s</b>.<br>""" % formatdate(conf.expires_on)
|
|
||||||
|
|
||||||
if 'System Manager' in webnotes.user.get_roles():
|
|
||||||
msg += """Just drop in a mail at <b>support@erpnext.com</b> and
|
|
||||||
we will guide you to get your account re-activated."""
|
|
||||||
else:
|
|
||||||
msg += """Just ask your System Manager to drop in a mail at <b>support@erpnext.com</b> and
|
|
||||||
we will guide him to get your account re-activated."""
|
|
||||||
|
|
||||||
webnotes.msgprint(msg)
|
|
||||||
|
|
||||||
webnotes.response['message'] = 'Account Expired'
|
|
||||||
raise webnotes.AuthenticationError
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user