From 0f04fcd2dbf79dea94ff91b7a979d79b29d87a19 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 11 Nov 2013 14:39:08 +0100 Subject: [PATCH 1/4] [minor] read ip from header HTTP_X_FORWARDED_FOR --- webnotes/__init__.py | 2 +- webnotes/auth.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webnotes/__init__.py b/webnotes/__init__.py index 28a4a78ba8..0a8e92b031 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -179,7 +179,7 @@ def get_env_vars(env_var): import os return os.environ.get(env_var,'None') -remote_ip = get_env_vars('REMOTE_ADDR') #Required for login from python shell +remote_ip = get_env_vars('HTTP_X_FORWARDED_FOR') or get_env_vars('REMOTE_ADDR') #Required for login from python shell logger = None def get_db_password(db_name): diff --git a/webnotes/auth.py b/webnotes/auth.py index 9ffcb1398e..a449c4e275 100644 --- a/webnotes/auth.py +++ b/webnotes/auth.py @@ -20,9 +20,9 @@ class HTTPRequest: # language self.set_lang(webnotes.get_env_vars('HTTP_ACCEPT_LANGUAGE')) - - webnotes.remote_ip = webnotes.get_env_vars('REMOTE_ADDR') + webnotes.remote_ip = webnotes.get_env_vars('HTTP_X_FORWARDED_FOR') or webnotes.get_env_vars('REMOTE_ADDR') + # load cookies webnotes.cookie_manager = CookieManager() @@ -115,7 +115,7 @@ class LoginManager: full_name = " ".join(filter(None, [info.first_name, info.last_name])) webnotes.response["full_name"] = full_name webnotes.add_cookies["full_name"] = full_name - + def post_login(self): self.run_trigger() self.validate_ip_address() @@ -271,4 +271,4 @@ def _update_password(user, password): @webnotes.whitelist() def get_logged_user(): - return webnotes.session.user \ No newline at end of file + return webnotes.session.user From 1ef1f2763eca754cb02f720ba384ad84ddecd7bb Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 13 Nov 2013 19:04:46 +0530 Subject: [PATCH 2/4] [fix] [minor] workflow icon fix --- public/js/wn/form/workflow.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/public/js/wn/form/workflow.js b/public/js/wn/form/workflow.js index 785e613c3c..db71004c95 100644 --- a/public/js/wn/form/workflow.js +++ b/public/js/wn/form/workflow.js @@ -83,19 +83,21 @@ wn.ui.form.States = Class.extend({ var state_doc = wn.model.get("Workflow State", {name:state})[0]; // set the icon - this.workflow_button.find('i').removeClass() + if (state_doc) { + this.workflow_button.find('i').removeClass() .addClass("icon-white") .addClass("icon-" + state_doc.icon); - // set the style - this.workflow_button.removeClass().addClass("btn btn-default dropdown-toggle") + // set the style + this.workflow_button.removeClass().addClass("btn btn-default dropdown-toggle") + + if(state_doc && state_doc.style) + this.workflow_button.addClass("btn-" + state_doc.style.toLowerCase()); + } - if(state_doc && state_doc.style) - this.workflow_button.addClass("btn-" + state_doc.style.toLowerCase()); - // show actions from that state this.show_actions(state); - + if(this.frm.doc.__islocal) { this.workflow_button.prop('disabled', true); } From 9e1c27a11e6c5c397b159b683ee2cf41ec850e1c Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 13 Nov 2013 19:07:03 +0530 Subject: [PATCH 3/4] [fix] [minor] workflow icon fix --- public/js/wn/form/workflow.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/wn/form/workflow.js b/public/js/wn/form/workflow.js index db71004c95..ebe2f1363f 100644 --- a/public/js/wn/form/workflow.js +++ b/public/js/wn/form/workflow.js @@ -82,11 +82,11 @@ wn.ui.form.States = Class.extend({ var state_doc = wn.model.get("Workflow State", {name:state})[0]; - // set the icon if (state_doc) { + // set the icon this.workflow_button.find('i').removeClass() - .addClass("icon-white") - .addClass("icon-" + state_doc.icon); + .addClass("icon-white") + .addClass("icon-" + state_doc.icon); // set the style this.workflow_button.removeClass().addClass("btn btn-default dropdown-toggle") From e7f7c42bddb51e2cb31ce5dea9cdd6f594ff7879 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 14 Nov 2013 13:22:23 +0530 Subject: [PATCH 4/4] [fix] [minor] report export related fix --- public/js/wn/misc/tools.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/wn/misc/tools.js b/public/js/wn/misc/tools.js index d8b046d3c6..7f5a406519 100644 --- a/public/js/wn/misc/tools.js +++ b/public/js/wn/misc/tools.js @@ -14,8 +14,8 @@ wn.tools.downloadify = function(data, roles, me) { var flash_disabled = (navigator.mimeTypes["application/x-shockwave-flash"] == undefined); var download_from_server = function() { - open_url_post("server.py?cmd=webnotes.utils.datautils.send_csv_to_client", - {args: {data: data, filename: me.title}}, true); + open_url_post("server.py", + {cmd: "webnotes.utils.datautils.send_csv_to_client", args: {data: data, filename: me.title}}, true); } // save file > abt 200 kb using server call