%!
import time, json
import splunk.appserver.mrsparkle.lib.i18n as i18n
# TRANS: This is the title for the account login page
title = _('Login')
%>
<%inherit file="//layout/base.html" />
<%namespace name="lib" file="//lib.html" import="*" />
<%
year = time.strftime('%Y')
#
# build all of the nagware parameters
#
# determine if UI has an error message displayed
hasErrorMessage = False
if invalid_password or logged_out or session_expired:
hasErrorMessage = True
# assemble dict to serialize into JSON for update checker
checkerConfig = {
'locale': i18n.current_lang_url_component(),
'licenseType': 'free' if serverInfo['is_free_license'] else 'pro',
'versionNumber': serverInfo['version_label'],
'installType': serverInfo['install_type'],
'skin': 'basic',
'updateCheckerBaseURL': updateCheckerBaseURL,
'tipsCheckerCannotConnectBannerPath': make_url('/static/img/nagware/updater_free_cannot_connect.gif'),
'updateCheckerCannotConnectBannerPath': make_url('/static/img/nagware/updater_pro_paid_login_cannot_connect.gif'),
'hasErrorMessage': hasErrorMessage,
'guid': serverInfo['guid'],
'cpu_arch': serverInfo['cpu_arch'],
'os_name': serverInfo['os_name'],
'return_to': return_to or '',
'license_desc': serverInfo['license_desc'],
'django': serverInfo['django']
}
# add harness for testing
debugPrefix = 'test.'
for k in checkerConfig:
if (debugPrefix + k) in cherrypy.request.params:
checkerConfig[k] = cherrypy.request.params[debugPrefix + k]
# determine CSS class on container
layoutClass = []
if checkerConfig['licenseType'] == 'free':
layoutClass.append('licenseIsFree')
if checkerConfig['installType'] == 'trial':
layoutClass.append('licenseIsTrial')
# output messaging
user_message = None
enable_login_form = True
# TRANS: Sign in button on the account login page
login_button_text = _('Sign in')
if invalid_password:
user_message = _('Invalid username or password.')
elif serverInfo['license_state'] == 'PREVIOUS_KEYED_LICENSE':
# the enums for license state are from SPL-24850
user_message = _('Splunk has detected that you are using a license for an older version of Splunk. Get an updated license.')
enable_login_form = False
# TRANS: Sign in button on the account login page when license is from previous version
login_button_text = _('N/A')
# handle expired licenses for all non admin users SPL-26253
elif serverInfo['license_state'] == 'EXPIRED':
user_message = _("%(openSpan1)s Your license is expired. %(closeSpan)s %(openSpan2)s Please login as an administrator to update the license. %(closeSpan)s") % { 'openSpan1': '', 'closeSpan': "", 'openSpan2':''}
elif bad_cookies:
user_message = _('Failed to set cookie. Ensure cookies are enabled in your browser.')
elif logged_out:
user_message = _('You have been logged out. Log in to return to the system.')
elif session_expired_pw_change: # must come before the check for session_expired
user_message = _('Your password was not updated as your session expired. Login again to start over')
elif session_expired:
user_message = _('Your session has expired. Log in to return to the system.')
%>
<%def name="css()">
<%lib:stylesheet_tags files="${['/static/css/login.css']}" />
<%lib:script_tags files="${['/static/js/contrib/jquery.cookie.js', '/static/js/contrib/spin.min.js','/static/js/login.js']}" />
%def>