diff options
-rw-r--r-- | newspipe/templates/admin/dashboard.html | 2 | ||||
-rw-r--r-- | newspipe/templates/profile.html | 4 | ||||
-rw-r--r-- | newspipe/web/forms.py | 3 | ||||
-rw-r--r-- | newspipe/web/views/views.py | 4 |
4 files changed, 8 insertions, 5 deletions
diff --git a/newspipe/templates/admin/dashboard.html b/newspipe/templates/admin/dashboard.html index db56be25..370ab702 100644 --- a/newspipe/templates/admin/dashboard.html +++ b/newspipe/templates/admin/dashboard.html @@ -9,6 +9,7 @@ <th>{{ _('Nickname') }}</th> <th>{{ _('Member since') }}</th> <th>{{ _('Last seen') }}</th> + <th>{{ _('External auth') }}</th> <th>{{ _('Actions') }}</th> </tr> </thead> @@ -26,6 +27,7 @@ </td> <td class="date">{{ user.date_created | datetime }}</td> <td class="date">{{ user.last_seen | datetime }}</td> + <td class="date">{{ user.external_auth | safe }}</td> <td> <a href="{{ url_for("admin.user_form", user_id=user.id) }}"><i class="fa fa-pencil-square-o" aria-hidden="true" title="{{ _('Edit this user') }}"></i></a> {% if user.id != current_user.id %} diff --git a/newspipe/templates/profile.html b/newspipe/templates/profile.html index 6cb59ed5..68ecab11 100644 --- a/newspipe/templates/profile.html +++ b/newspipe/templates/profile.html @@ -23,11 +23,11 @@ {{ form.nickname.label }} {{ form.nickname(class_="form-control") }} {% for error in form.nickname.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} - {{ form.password.label }} + {% if not user.external_auth %}{{ form.password.label }} {{ form.password(class_="form-control") }} {% for error in form.password.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} {{ form.password_conf.label }} - {{ form.password_conf(class_="form-control") }} {% for error in form.password_conf.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} + {{ form.password_conf(class_="form-control") }} {% for error in form.password_conf.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}{% else%}{% for error in form.password.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}No password management for auth type {{ user.external_auth }}{% endif %} </div> <div class="col"> diff --git a/newspipe/web/forms.py b/newspipe/web/forms.py index 4cd552e0..7a245b94 100644 --- a/newspipe/web/forms.py +++ b/newspipe/web/forms.py @@ -173,6 +173,7 @@ class SigninForm(RedirectForm): automatic_crawling=True, is_admin=False, is_active=True, + external_auth="ldap", ) if user: validated = True @@ -199,7 +200,7 @@ class SigninForm(RedirectForm): self.password.errors.append("Wrong password") validated = False else: - self.password.errors.append("External auth unavailable. Contact the admin.") + self.password.errors.append("External auth {user.external_auth} unavailable. Contact the admin.") validated = False self.user = user return validated diff --git a/newspipe/web/views/views.py b/newspipe/web/views/views.py index 7ff2a2e4..bb7bff2f 100644 --- a/newspipe/web/views/views.py +++ b/newspipe/web/views/views.py @@ -25,7 +25,7 @@ logger = logging.getLogger(__name__) @current_app.errorhandler(401) def authentication_required(error): - if application.conf["API_ROOT"] in request.url: + if application.config["API_ROOT"] in request.url: return error flash(gettext("Authentication required."), "info") return redirect(url_for("login")) @@ -33,7 +33,7 @@ def authentication_required(error): @current_app.errorhandler(403) def authentication_failed(error): - if application.conf["API_ROOT"] in request.url: + if application.config["API_ROOT"] in request.url: return error flash(gettext("Forbidden."), "danger") return redirect(url_for("login")) |