Don't try to render security URLs in desktop mode. Fixes #2952. Fixes #2922

pull/6/head
Murtuza Zabuawala 2017-12-18 09:15:36 +00:00 committed by Dave Page
parent 937984f2dc
commit bceb6aef3c
5 changed files with 9 additions and 5 deletions

View File

@ -540,11 +540,8 @@ def create_app(app_name=None):
): ):
abort(401) abort(401)
if not config.SERVER_MODE: if not config.SERVER_MODE and not current_user.is_authenticated:
@app.before_first_request
def before_first_request():
user = user_datastore.get_user(config.DESKTOP_USER) user = user_datastore.get_user(config.DESKTOP_USER)
# Throw an error if we failed to find the desktop user, to give # Throw an error if we failed to find the desktop user, to give
# the sysadmin a hint. We'll continue to try to login anyway as # the sysadmin a hint. We'll continue to try to login anyway as
# that'll through a nice 500 error for us. # that'll through a nice 500 error for us.
@ -554,7 +551,6 @@ def create_app(app_name=None):
% config.DESKTOP_USER % config.DESKTOP_USER
) )
abort(401) abort(401)
login_user(user) login_user(user)
@app.after_request @app.after_request

View File

@ -1,6 +1,7 @@
{% extends "security/panel.html" %} {% extends "security/panel.html" %}
{% block panel_title %}{{ _('%(appname)s Password Change', appname=config.APP_NAME) }}{% endblock %} {% block panel_title %}{{ _('%(appname)s Password Change', appname=config.APP_NAME) }}{% endblock %}
{% block panel_body %} {% block panel_body %}
{% if config.SERVER_MODE %}
<form action="{{ url_for('browser.change_password') }}" method="POST" name="change_password_form"> <form action="{{ url_for('browser.change_password') }}" method="POST" name="change_password_form">
{{ change_password_form.hidden_tag() }} {{ change_password_form.hidden_tag() }}
<fieldset> <fieldset>
@ -10,4 +11,5 @@
<input class="btn btn-lg btn-success btn-block" type="submit" value="{{ _('Change Password') }}"> <input class="btn btn-lg btn-success btn-block" type="submit" value="{{ _('Change Password') }}">
</fieldset> </fieldset>
</form> </form>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -1,6 +1,7 @@
{% extends "security/panel.html" %} {% extends "security/panel.html" %}
{% block panel_title %}{{ _('Recover %(appname)s Password', appname=config.APP_NAME) }}{% endblock %} {% block panel_title %}{{ _('Recover %(appname)s Password', appname=config.APP_NAME) }}{% endblock %}
{% block panel_body %} {% block panel_body %}
{% if config.SERVER_MODE %}
<p>{{ _('Enter the email address for the user account you wish to recover the password for:') }}</p> <p>{{ _('Enter the email address for the user account you wish to recover the password for:') }}</p>
<form action="{{ url_for('browser.forgot_password') }}" method="POST" name="forgot_password_form"> <form action="{{ url_for('browser.forgot_password') }}" method="POST" name="forgot_password_form">
{{ forgot_password_form.hidden_tag() }} {{ forgot_password_form.hidden_tag() }}
@ -9,4 +10,5 @@
<input class="btn btn-lg btn-success btn-block" type="submit" value="{{ _('Recover Password') }}"> <input class="btn btn-lg btn-success btn-block" type="submit" value="{{ _('Recover Password') }}">
</fieldset> </fieldset>
</form> </form>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -1,6 +1,7 @@
{% extends "security/panel.html" %} {% extends "security/panel.html" %}
{% block panel_title %}{{ _('%(appname)s Login', appname=config.APP_NAME) }}{% endblock %} {% block panel_title %}{{ _('%(appname)s Login', appname=config.APP_NAME) }}{% endblock %}
{% block panel_body %} {% block panel_body %}
{% if config.SERVER_MODE %}
<form action="{{ url_for_security('login') }}" method="POST" name="login_user_form"> <form action="{{ url_for_security('login') }}" method="POST" name="login_user_form">
{{ login_user_form.hidden_tag() }} {{ login_user_form.hidden_tag() }}
{% set user_language = request.cookies.get('PGADMIN_LANGUAGE') or 'en' %} {% set user_language = request.cookies.get('PGADMIN_LANGUAGE') or 'en' %}
@ -21,4 +22,5 @@
</fieldset> </fieldset>
</form> </form>
<span class="help-block">{{ _('Forgotten your <a href="%(url)s">password</a>?', url=url_for('browser.forgot_password')) }}</span> <span class="help-block">{{ _('Forgotten your <a href="%(url)s">password</a>?', url=url_for('browser.forgot_password')) }}</span>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -1,6 +1,7 @@
{% extends "security/panel.html" %} {% extends "security/panel.html" %}
{% block panel_title %}{{ _('%(appname)s Password Reset', appname=config.APP_NAME) }}{% endblock %} {% block panel_title %}{{ _('%(appname)s Password Reset', appname=config.APP_NAME) }}{% endblock %}
{% block panel_body %} {% block panel_body %}
{% if config.SERVER_MODE %}
<form action="{{ url_for('browser.reset_password', token=reset_password_token) }}" method="POST" <form action="{{ url_for('browser.reset_password', token=reset_password_token) }}" method="POST"
name="reset_password_form"> name="reset_password_form">
{{ reset_password_form.hidden_tag() }} {{ reset_password_form.hidden_tag() }}
@ -10,4 +11,5 @@
<input class="btn btn-lg btn-success btn-block" type="submit" value="{{ _('Reset Password') }}"> <input class="btn btn-lg btn-success btn-block" type="submit" value="{{ _('Reset Password') }}">
</fieldset> </fieldset>
</form> </form>
{% endif %}
{% endblock %} {% endblock %}