diff --git a/tests/utils.py b/tests/utils.py index 82194221a79dd325df3850d0f63769687e869881..0fd6fbb85896107ea96c0cac1a183d3255464279 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -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) diff --git a/uffd/__init__.py b/uffd/__init__.py index e370e999cdfcb4321e55bedb2d8b117100136165..55fa8360cce8fb3ee7b4355e9a258efd5b74386a 100644 --- a/uffd/__init__.py +++ b/uffd/__init__.py @@ -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 diff --git a/uffd/default_config.cfg b/uffd/default_config.cfg index 0628f1068c65c8606597caba3fc757dafd56d83b..8eadca78f51e0df218abf0932ddf418725801e3b 100644 --- a/uffd/default_config.cfg +++ b/uffd/default_config.cfg @@ -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 diff --git a/uffd/rolemod/templates/rolemod/show.html b/uffd/rolemod/templates/rolemod/show.html index c1749468ae7e7192f0fce00f8eedc0a40f3f94bd..7dba0f8649d1d55e8590e43bbb31f08cacefedbc 100644 --- a/uffd/rolemod/templates/rolemod/show.html +++ b/uffd/rolemod/templates/rolemod/show.html @@ -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> diff --git a/uffd/selfservice/templates/selfservice/self.html b/uffd/selfservice/templates/selfservice/self.html index 79f4b0da87e39126acb89262663171482d1ac30e..d505d2bbcdc2fb56ffa0d807f4441391542b6520 100644 --- a/uffd/selfservice/templates/selfservice/self.html +++ b/uffd/selfservice/templates/selfservice/self.html @@ -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 %} diff --git a/uffd/selfservice/views.py b/uffd/selfservice/views.py index 2be17e32064f6c6a1d944e6469a7d516ce9cd155..8760499ac099aed9dc070c630b8710d658c621d2 100644 --- a/uffd/selfservice/views.py +++ b/uffd/selfservice/views.py @@ -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() diff --git a/uffd/session/templates/session/login.html b/uffd/session/templates/session/login.html index 3818d94321e208d867298404765a4aa4a980e2b2..fc3ba82e55c9fbde6e189eb6c426792c7a486fd8 100644 --- a/uffd/session/templates/session/login.html +++ b/uffd/session/templates/session/login.html @@ -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 %}