Merge pull request #4089 from mbauskar/minor-fixes

[hotfix] minor fixes for text editor, report print and 2fa
This commit is contained in:
Rushabh Mehta 2017-09-12 11:34:25 +05:30 committed by GitHub
commit f57dfc04c7
4 changed files with 7 additions and 3 deletions

View file

@ -46,7 +46,8 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({
// this function is executed only once
$(".note-editable[contenteditable='true']").one('focus', function() {
var $this = $(this);
$this.html($this.html() + '<br>');
if(!$this.html())
$this.html($this.html() + '<br>');
});
},
onChange: function(value) {

View file

@ -24,7 +24,7 @@
{% for col in columns %}
{% if col.name && col._id !== "_check" %}
{% var value = col.fieldname ? row[col.fieldname] : row[col.id]; %}
{% var value = col.fieldname ? row[col.fieldname] : row[col.field]; %}
<td>{{ col.formatter
? col.formatter(row._index, col._index, value, col, row, true)

View file

@ -51,6 +51,7 @@ class TestTwoFactor(unittest.TestCase):
'''Should return true if enabled for user.'''
toggle_2fa_all_role(state=True)
self.assertTrue(two_factor_is_enabled_for_(self.user))
self.assertFalse(two_factor_is_enabled_for_("Administrator"))
toggle_2fa_all_role(state=False)
self.assertFalse(two_factor_is_enabled_for_(self.user))
@ -87,7 +88,6 @@ class TestTwoFactor(unittest.TestCase):
_str = render_string_template(_str,args)
self.assertEqual(_str,'Verification Code from Frappe Technologies')
def set_request(**kwargs):
builder = EnvironBuilder(**kwargs)
frappe.local.request = Request(builder.get_environ())

View file

@ -74,6 +74,9 @@ def cache_2fa_data(user, token, otp_secret, tmp_id):
def two_factor_is_enabled_for_(user):
'''Check if 2factor is enabled for user.'''
if user == "Administrator":
return False
if isinstance(user, string_types):
user = frappe.get_doc('User', user)