Change place holder based on system settings

add place holder in login.py and then use in template
This commit is contained in:
shridhar 2017-09-14 12:15:58 +05:30
parent 9d6193bf70
commit fb48bca8dd
2 changed files with 11 additions and 11 deletions

View file

@ -16,17 +16,7 @@
</div>
<input type="text" id="login_email"
class="form-control" placeholder="{{
_('Email address or Mobile number or Username')
if frappe.utils.cint(frappe.db.get_value('System Settings', 'System Settings', 'allow_login_using_mobile_number')) and frappe.utils.cint(frappe.db.get_value('System Settings', 'System Settings', 'allow_login_using_user_name'))
else (
_('Email address or Username')
if frappe.utils.cint(frappe.db.get_value('System Settings', 'System Settings', 'allow_login_using_user_name'))
else (
_('Email address or Mobile number')
if frappe.utils.cint(frappe.db.get_value('System Settings', 'System Settings', 'allow_login_using_mobile_number'))
else _('Email address'))
) }}"
class="form-control" placeholder="{{ login_name_placeholder }}"
required autofocus>

View file

@ -31,6 +31,16 @@ def get_context(context):
ldap_settings = get_ldap_settings()
context["ldap_settings"] = ldap_settings
login_name_placeholder = "Email address"
if frappe.utils.cint(frappe.db.get_value("System Settings", "System Settings", "allow_login_using_mobile_number")):
login_name_placeholder += " or Mobile number"
if frappe.utils.cint(frappe.db.get_value("System Settings", "System Settings", "allow_login_using_user_name")):
login_name_placeholder += " or Username"
context['login_name_placeholder'] = login_name_placeholder
return context
@frappe.whitelist(allow_guest=True)