Skip to content
Snippets Groups Projects
Commit e32d037d authored by Julian's avatar Julian
Browse files

Remove ENABLE_INVITE/PASSWORDRESET/ROLESELFSERVICE options

The options were introduced to cleanly handle LDAP user connections. Since
LDAP support is now gone and hence user connections are gone too, these
options are no longer necessary. While the options may be useful in other
cases, we cannot continuously test them and so we are removing them for now.
parent 446f9952
No related branches found
No related tags found
No related merge requests found
......@@ -65,8 +65,6 @@ class UffdTestCase(unittest.TestCase):
'SECRET_KEY': 'DEBUGKEY',
'MAIL_SKIP_SEND': True,
'SELF_SIGNUP': True,
'ENABLE_INVITE': True,
'ENABLE_PASSWORDRESET': True
}
self.app = create_app(config)
......
......@@ -59,7 +59,6 @@ def init_config(app: Flask, test_config):
app.config.setdefault("SECRET_KEY", secrets.token_hex(128))
def create_app(test_config=None): # pylint: disable=too-many-locals,too-many-statements
# create and configure the app
app = Flask(__name__, instance_relative_config=False)
app.json_encoder = SQLAlchemyJSON
......@@ -81,15 +80,9 @@ def create_app(test_config=None): # pylint: disable=too-many-locals,too-many-sta
db.init_app(app)
Migrate(app, db, render_as_batch=True, directory=os.path.join(app.root_path, 'migrations'))
for i in user.bp + selfservice.bp + role.bp + mail.bp + session.bp + csrf.bp + mfa.bp + oauth2.bp + services.bp + rolemod.bp + api.bp:
app.register_blueprint(i)
if app.config['ENABLE_INVITE'] or app.config['SELF_SIGNUP']:
for i in signup.bp:
app.register_blueprint(i)
if app.config['ENABLE_INVITE']:
for i in invite.bp:
app.register_blueprint(i)
for module in [user, selfservice, role, mail, session, csrf, mfa, oauth2, services, rolemod, api, signup, invite]:
for bp in module.bp:
app.register_blueprint(bp)
@app.shell_context_processor
def push_request_context(): #pylint: disable=unused-variable
......
......@@ -33,10 +33,6 @@ MAIL_PASSWORD='*****'
MAIL_USE_STARTTLS=True
MAIL_FROM_ADDRESS='foo@bar.com'
# The following settings are not available when using a user connection
ENABLE_INVITE=True
ENABLE_PASSWORDRESET=True
ENABLE_ROLESELFSERVICE=True
# Do not enable this on a public service! There is no spam protection implemented at the moment.
SELF_SIGNUP=False
......
......@@ -4,9 +4,7 @@
<form method="POST" action="{{ url_for("rolemod.update", role_id=role.id) }}">
<div class="float-sm-right pb-2">
{% if config['ENABLE_INVITE'] %}
<a href="{{ url_for("invite.new", **{"role-%d"%role.id: 1}) }}" class="btn btn-primary mr-2"><i class="fa fa-link" aria-hidden="true"></i> {{_('Invite Members')}}</a>
{% endif %}
<button type="submit" class="btn btn-primary"><i class="fa fa-save" aria-hidden="true"></i> {{_('Save')}}</button>
<a href="{{ url_for("rolemod.index") }}" class="btn btn-secondary">{{_('Cancel')}}</a>
</div>
......
......@@ -90,11 +90,7 @@
{% endif %}
</div>
<div class="col-12 col-md-7">
{% if config['ENABLE_INVITE'] %}
<p>{{_("Administrators and role moderators can invite you to new roles.")}}</p>
{% else %}
<p>{{_("Administrators can add new roles to your account.")}}</p>
{% endif %}
<table class="table">
<thead>
<tr>
......@@ -113,11 +109,9 @@
</td>
<td>{{ role.description }}</td>
<td>
{% if config['ENABLE_ROLESELFSERVICE'] %}
<form action="{{ url_for("selfservice.leave_role", roleid=role.id) }}" method="POST" onsubmit='return confirm({{_("Are you sure?")|tojson|e}});'>
<button type="submit" class="btn btn-sm btn-danger float-right">{{_("Leave")}}</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
......
......@@ -130,9 +130,6 @@ def token_mail(token_id, token):
@csrf_protect(blueprint=bp)
@login_required(selfservice_acl_check)
def leave_role(roleid):
if not current_app.config['ENABLE_ROLESELFSERVICE']:
flash(_('Leaving roles is disabled'))
return redirect(url_for('selfservice.index'))
role = Role.query.get_or_404(roleid)
role.members.remove(request.user)
request.user.update_groups()
......
......@@ -26,9 +26,7 @@
{% if config['SELF_SIGNUP'] %}
<a href="{{ url_for("signup.signup_start") }}" class="float-left">{{_("Register")}}</a>
{% endif %}
{% if config['ENABLE_PASSWORDRESET'] %}
<a href="{{ url_for("selfservice.forgot_password") }}" class="float-right">{{_("Forgot Password?")}}</a>
{% endif %}
</div>
</form>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment