Revert "Added the ability to disable registration in the config file"

This reverts commit a5211d9

Functionality already exists through elevating the privilege of the users:create role above anonymous
This commit is contained in:
ReAnzu 2018-02-23 20:58:19 -06:00
parent a5211d9483
commit 40ac9185b3
2 changed files with 16 additions and 21 deletions

View file

@ -51,8 +51,6 @@ enable_safety: yes
tag_name_regex: ^\S+$ tag_name_regex: ^\S+$
tag_category_name_regex: ^[^\s%+#/]+$ tag_category_name_regex: ^[^\s%+#/]+$
# Disable registration by setting false
registration_enabled: true
# don't make these more restrictive unless you want to annoy people; if you do # don't make these more restrictive unless you want to annoy people; if you do
# customize them, make sure to update the instructions in the registration form # customize them, make sure to update the instructions in the registration form

View file

@ -1,5 +1,5 @@
from typing import Any, Dict from typing import Any, Dict
from szurubooru import model, search, rest, config, errors from szurubooru import model, search, rest
from szurubooru.func import auth, users, serialization, versions from szurubooru.func import auth, users, serialization, versions
@ -26,7 +26,6 @@ def get_users(
@rest.routes.post('/users/?') @rest.routes.post('/users/?')
def create_user( def create_user(
ctx: rest.Context, _params: Dict[str, str] = {}) -> rest.Response: ctx: rest.Context, _params: Dict[str, str] = {}) -> rest.Response:
if config.config['registration_enabled']:
auth.verify_privilege(ctx.user, 'users:create') auth.verify_privilege(ctx.user, 'users:create')
name = ctx.get_param_as_string('name') name = ctx.get_param_as_string('name')
password = ctx.get_param_as_string('password') password = ctx.get_param_as_string('password')
@ -42,8 +41,6 @@ def create_user(
ctx.session.add(user) ctx.session.add(user)
ctx.session.commit() ctx.session.commit()
return _serialize(ctx, user, force_show_email=True) return _serialize(ctx, user, force_show_email=True)
else:
raise errors.ValidationError('User Registration Disabled')
@rest.routes.get('/user/(?P<user_name>[^/]+)/?') @rest.routes.get('/user/(?P<user_name>[^/]+)/?')