diff --git a/nerochan/cli.py b/nerochan/cli.py index 8c8ac61..c0451e1 100644 --- a/nerochan/cli.py +++ b/nerochan/cli.py @@ -105,7 +105,7 @@ def cli(app): u = User( handle=user, wallet_address=data[user]['wallet'], - is_approved=True + is_verified=True ) u.save() _user = u diff --git a/nerochan/models.py b/nerochan/models.py index 89c2eaa..568717f 100644 --- a/nerochan/models.py +++ b/nerochan/models.py @@ -29,7 +29,7 @@ class User(pw.Model): challenge = pw.CharField(default=gen_challenge) is_admin = pw.BooleanField(default=False) is_mod = pw.BooleanField(default=False) - is_approved = pw.BooleanField(default=False) + is_verified = pw.BooleanField(default=False) is_banned = pw.BooleanField(default=False) @property diff --git a/nerochan/routes/admin.py b/nerochan/routes/admin.py index e8b46cf..f1c5741 100644 --- a/nerochan/routes/admin.py +++ b/nerochan/routes/admin.py @@ -12,12 +12,18 @@ bp = Blueprint('admin', 'admin', url_prefix='/admin') @login_required @admin_required def main(): - user_form = UserForm() - if user_form.validate_on_submit(): - u = User.select().where(User.handle == user_form.handle.data).first() + admin_form = UserForm() + artist_form = UserForm() + if admin_form.validate_on_submit(): + u = User.select().where(User.handle == admin_form.handle.data).first() u.is_admin = True u.save() return redirect(request.referrer) + if artist_form.validate_on_submit(): + u = User.select().where(User.handle == artist_form.handle.data).first() + u.is_verified = True + u.save() + return redirect(request.referrer) if request.args.get('remove'): a = User.select().where(User.handle == request.args.get('remove')).first() if a == current_user: @@ -27,11 +33,20 @@ def main(): a.is_admin = False a.save() return redirect(url_for('admin.main')) + if request.args.get('unverify'): + a = User.select().where(User.handle == request.args.get('unverify')).first() + if a: + a.is_verified = False + a.save() + return redirect(url_for('admin.main')) admins = User.select().where(User.is_admin == True).order_by(User.register_date.desc()) + artists = User.select().where(User.is_verified == True).order_by(User.register_date.desc()) return render_template( 'admin/main.html', admins=admins, - user_form=user_form + artists=artists, + admin_form=admin_form, + artist_form=artist_form ) # approve artwork diff --git a/nerochan/routes/main.py b/nerochan/routes/main.py index 9ccff1a..c92ad1d 100644 --- a/nerochan/routes/main.py +++ b/nerochan/routes/main.py @@ -11,7 +11,7 @@ bp = Blueprint('main', 'main') @bp.route('/') def index(): users = User.select().where( - User.is_approved == True + User.is_verified == True ).order_by(User.register_date.desc()).limit(10) artwork = Artwork.select().where( Artwork.approved == True, diff --git a/nerochan/templates/admin/main.html b/nerochan/templates/admin/main.html index 0b87df7..b4861c7 100644 --- a/nerochan/templates/admin/main.html +++ b/nerochan/templates/admin/main.html @@ -5,19 +5,23 @@

admins

-

Add a homie

+

+ Add a homie to be an admin.
+ Admins can manage other admins as well as hide artwork,
+ approve/reject artwork, ban artists, and verify artists. +

- {{ user_form.csrf_token }} + {{ admin_form.csrf_token }}
- {{ user_form.handle }} + {{ admin_form.handle }}
    - {%- for field, errors in user_form.errors.items() %} + {%- for field, errors in admin_form.errors.items() %}
  • {{ ', '.join(errors) }}
  • {%- endfor %}
@@ -28,6 +32,35 @@ {% endfor %}
+
+
+

artists

+

+ Verified artists will skip the queue
+ and have their artwork displayed immediately. +

+ + {{ artist_form.csrf_token }} +
+
+ {{ artist_form.handle }} +
+
+ +
+
+ + + +
{% endblock %}