From 25625107b6c7805b474ad7da976171991b259e58 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Sun, 8 Sep 2013 18:26:37 -0400 Subject: This was a quick update, I mostly worked on the transition from using the old User table columns (is_admin, status, email_verified) and making sure that their functionality is instead completely handled by privileges. I also worked on the meta pages which I hope to finish soon. I set up migrations to ensure the default privileges are given to users that should have them. Lastly, I made it so that banned users can log out. =============================================================================== Made Sure the Vestigial Columns of the User Table were not being Used =============================================================================== --\ mediagoblin/auth/views.py --\ mediagoblin/db/models.py --\ mediagoblin/templates/mediagoblin/base.html --\ mediagoblin/templates/mediagoblin/moderation/user.html --\ mediagoblin/templates/mediagoblin/user_pages/collection_lis$ --\ mediagoblin/templates/mediagoblin/user_pages/user.html --\ mediagoblin/tests/test_auth.py --\ mediagoblin/tests/test_persona.py --\ mediagoblin/user_pages/views.py =============================================================================== Wrote the Migrations to Set up the Default Privileges =============================================================================== --\ mediagoblin/db/migrations.py --\ mediagoblin/gmg_commands/users.py =============================================================================== Work on the Meta Pages =============================================================================== --\ mediagoblin/meta/routing.py --\ mediagoblin/meta/views.py --\ mediagoblin/static/css/base.css --\ mediagoblin/templates/mediagoblin/meta/terms_of_service.html =============================================================================== Small Changes =============================================================================== --\ mediagoblin/templates/mediagoblin/base.html --| Benevolently made it so that banned users can log out =============================================================================== X X X X X X X X X X X X X X X X X X X X =============================================================================== --- mediagoblin/auth/views.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'mediagoblin/auth') diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 7d95b81a..5e2a2af0 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -150,9 +150,7 @@ def verify_email(request): user = User.query.filter_by(id=int(token)).first() - if user and user.email_verified is False: - user.status = u'active' - user.email_verified = True + if user and user.has_privilege(u'active') is False: user.verification_key = None user.all_privileges.append( Privilege.query.filter( @@ -191,7 +189,7 @@ def resend_activation(request): return redirect(request, 'mediagoblin.auth.login') - if request.user.email_verified: + if request.user.has_privilege(u'active'): messages.add_message( request, messages.ERROR, @@ -256,7 +254,7 @@ def forgot_password(request): success_message=_("An email has been sent with instructions " "on how to change your password.") - if user and not(user.email_verified and user.status == 'active'): + if user and not(user.has_privilege(u'active')): # Don't send reminder because user is inactive or has no verified email messages.add_message(request, messages.WARNING, @@ -312,8 +310,8 @@ def verify_forgot_password(request): return redirect( request, 'index') - # check if user active and has email verified - if user.email_verified and user.status == 'active': + # check if user active + if user.has_privilege(u'active'): cp_form = auth_forms.ChangePassForm(formdata_vars) @@ -333,13 +331,13 @@ def verify_forgot_password(request): 'mediagoblin/auth/change_fp.html', {'cp_form': cp_form,}) - if not user.email_verified: + if not user.has_privilege(u'active'): messages.add_message( request, messages.ERROR, _('You need to verify your email before you can reset your' ' password.')) - if not user.status == 'active': + if not user.has_privilege(u'active'): messages.add_message( request, messages.ERROR, _('You are no longer an active user. Please contact the system' -- cgit v1.2.3