[pgAdmin4][Patch]: Remove fixed width from sql-hint popup - Query tool

2017-11-29 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue where long database object names were
truncated and not visible due to fixed pop-up size.
RM#2726

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css 
b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
index 8f1ab44..782d3e7 100644
--- a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
+++ b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
@@ -214,7 +214,6 @@
   margin: 0;
   padding: 0 4px;
   border-radius: 2px;
-  max-width: 19em;
   overflow: hidden;
   white-space: pre;
   color: black;


pgAdmin 4 commit: Add missing __init__.py to backports.csv when buildin

2017-11-29 Thread Dave Page
Add missing __init__.py to backports.csv when building the MSVC windows build. 
Fixes #2918

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=4617a90123b22381682e9fe2942b7471c70b5cb2
Author: Maxim Zakharov 

Modified Files
--
Make.bat | 3 +++
1 file changed, 3 insertions(+)



pgAdmin 4 commit: Ensure the auto-complete selection list can display l

2017-11-29 Thread Dave Page
Ensure the auto-complete selection list can display longer names. Fixes #2726

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=f10733e8d42370cb4456f5c2560e3c10da849147
Author: Murtuza Zabuawala 

Modified Files
--
web/pgadmin/tools/sqleditor/static/css/sqleditor.css | 1 -
1 file changed, 1 deletion(-)



Re: [pgAdmin4][Patch]: Remove fixed width from sql-hint popup - Query tool

2017-11-29 Thread Dave Page
Thanks, applied.

On Wed, Nov 29, 2017 at 8:23 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA minor patch to fix the issue where long database object names were
> truncated and not visible due to fixed pop-up size.
> RM#2726
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


[pgAdmin4][RM2892] Handle password changes properly if error occurs during sending email

2017-11-29 Thread Harshal Dhumal
Hi,

Unlike flask login-manager flask-security does not provide facility to pass
custom view
function to any of callbacks like change/reset/forgot password. So we cannot
handle any exceptions occurred during changing/resetting password.
Only way we can handle such exceptions is writing our own routes for these
callbacks and
add addition code to handle such exceptions.

-- 
*Harshal Dhumal*
*Sr. Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index a1d10b8..0196852 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -174,6 +174,23 @@ def create_app(app_name=None):
 if not app_name:
 app_name = config.APP_NAME
 
+# Only enable password related functionality in server mode.
+if config.SERVER_MODE is True:
+# Some times we need to access these config params where application
+# context is not available (we can't use current_app.config in those
+# cases even with current_app.app_context())
+# So update these params in config itself.
+# And also these updated config values will picked up by application
+# since we are updating config before the application instance is
+# created.
+
+config.SECURITY_RECOVERABLE = True
+config.SECURITY_CHANGEABLE = True
+# Now we'll open change password page in alertify dialog
+# we don't want it to redirect to main page after password
+# change operation so we will open the same password change page again.
+config.SECURITY_POST_CHANGE_VIEW = 'browser.change_password'
+
 """Create the Flask application, startup logging and dynamically load
 additional modules (blueprints) that are found in this directory."""
 app = PgAdmin(__name__, static_url_path='/static')
@@ -276,18 +293,6 @@ def create_app(app_name=None):
 getattr(config, 'SQLITE_TIMEOUT', 500)
 )
 
-# Only enable password related functionality in server mode.
-if config.SERVER_MODE is True:
-# TODO: Figure out how to disable /logout and /login
-app.config['SECURITY_RECOVERABLE'] = True
-app.config['SECURITY_CHANGEABLE'] = True
-# Now we'll open change password page in alertify dialog
-# we don't want it to redirect to main page after password
-# change operation so we will open the same password change page again.
-app.config.update(
-dict(SECURITY_POST_CHANGE_VIEW='security.change_password')
-)
-
 # Create database connection object and mailer
 db.init_app(app)
 
diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py
index a70a751..b54441b 100644
--- a/web/pgadmin/browser/__init__.py
+++ b/web/pgadmin/browser/__init__.py
@@ -8,19 +8,32 @@
 ##
 
 import json
+import logging
 from abc import ABCMeta, abstractmethod, abstractproperty
-
 import six
+from socket import error as SOCKETErrorException
+from smtplib import SMTPConnectError, SMTPResponseException,\
+SMTPServerDisconnected, SMTPDataError,SMTPHeloError, SMTPException, \
+SMTPAuthenticationError, SMTPSenderRefused, SMTPRecipientsRefused
 from flask import current_app, render_template, url_for, make_response, flash,\
-Response
+Response, request, after_this_request, redirect
 from flask_babel import gettext
-from flask_login import current_user
-from flask_security import login_required
+from flask_login import current_user, login_required
+from flask_security.decorators import anonymous_user_required
 from flask_gravatar import Gravatar
 from pgadmin.settings import get_setting
 from pgadmin.utils import PgAdminModule
 from pgadmin.utils.ajax import make_json_response
 from pgadmin.utils.preferences import Preferences
+from werkzeug.datastructures import MultiDict
+from flask_security.views import _security, _commit, _render_json, _ctx
+from flask_security.changeable import change_user_password
+from flask_security.recoverable import reset_password_token_status, \
+generate_reset_password_token, update_password
+from flask_security.utils import config_value, do_flash, get_url, get_message,\
+slash_url_suffix, login_user, send_mail
+from flask_security.signals import reset_password_instructions_sent
+
 
 import config
 from pgadmin import current_blueprint
@@ -528,6 +541,7 @@ def index():
 
 return response
 
+
 @blueprint.route("/js/utils.js")
 @login_required
 def utils():
@@ -677,3 +691,188 @@ def get_nodes():
 nodes.extend(submodule.get_nodes())
 
 return make_json_response(data=nodes)
+
+# Only register route if SECURITY_CHANGEABLE is set to True
+# We can't access app context here so cannot
+# use app.config['SECURITY_CHANGEABLE']
+if hasattr(config, 'SECURITY_CHANGEABLE') and config.SECURITY_CHANGEABLE:
+@blueprint.route("/change_password", endpoint="change_p

pgAdmin 4 commit: Fixing the lint error messages in javascript using 'e

2017-11-29 Thread Ashesh Vashi
Fixing the lint error messages in javascript using 'eslint --fix'
command.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=d54c35d74f5851a6aa6f79c162c1ea1f7fa75b52

Modified Files
--
.../js/selection/range_boundary_navigator.js   | 236 ++---
web/pgadmin/static/jsx/history/query_history.jsx   |   6 +-
.../static/jsx/history/query_history_entries.jsx   |  10 +-
.../javascript/selection/copy_data_spec.js |   4 +-
.../selection/range_boundary_navigator_spec.js |  16 +-
.../javascript/selection/set_staged_rows_spec.js   |   6 +-
6 files changed, 139 insertions(+), 139 deletions(-)



pgAdmin 4 commit: Using the correct type name (along with the internal

2017-11-29 Thread Ashesh Vashi
Using the correct type name (along with the internal name) while
generating the query for update/insert table data (Data grid).

Modified by Ashesh for array support.

Fixes #2830

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=281b6c91b5f61e64e876ebb93202de93d6e020d2
Author: Akshay Joshi 

Modified Files
--
web/pgadmin/tools/sqleditor/__init__.py | 25 -
1 file changed, 24 insertions(+), 1 deletion(-)



pgAdmin 4 commit: Do not show success message, when there is an error s

2017-11-29 Thread Ashesh Vashi
Do not show success message, when there is an error saving the data in
the DataGrid.

Fixes #2907

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=ea82d92e41e985eb79fc36087aef5c8e82cb2260
Author: Akshay Joshi 

Modified Files
--
web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 40 --
1 file changed, 21 insertions(+), 19 deletions(-)



[pgAdmin4][RM2922] Login desktop user only once in runtime

2017-11-29 Thread Harshal Dhumal
Hi,

Please find attached patch to fix issue where desktop user was logged in
each request
in runtime.

-- 
*Harshal Dhumal*
*Sr. Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index a1d10b8..48c1b56 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -535,7 +535,9 @@ def create_app(app_name=None):
 ):
 abort(401)
 
-if not config.SERVER_MODE:
+if not config.SERVER_MODE:
+@app.before_first_request
+def before_first_request():
 user = user_datastore.get_user(config.DESKTOP_USER)
 
 # Throw an error if we failed to find the desktop user, to give