From: Christopher Allan Webber Date: Fri, 29 Jul 2011 03:12:24 +0000 (-0500) Subject: Give useful verification information on users that need to verify their email X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=990d3b6985041facf391f4ece0829a11c0fd317e;p=mediagoblin.git Give useful verification information on users that need to verify their email --- diff --git a/mediagoblin/templates/mediagoblin/user_pages/user.html b/mediagoblin/templates/mediagoblin/user_pages/user.html index b0c1027c..ae540bfe 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/user.html +++ b/mediagoblin/templates/mediagoblin/user_pages/user.html @@ -25,22 +25,49 @@ {% endblock mediagoblin_head %} {% block mediagoblin_content -%} - {% if user %} - -
-

Verification needed

- -

Almost done! Your account still needs to be verified.

-

An email should arrive in a few moments with instructions on how to do so.

-

In case it doesn't:

- - Resend verification email - -

Someone has registered an account with this username, but it still has to be verified.

-

If you are that person but you've lost your verification email, you can log in and resend it.

-
- {# + {# If no user... #} + {% if not user %} +

Sorry, no such user found.

+ + {# User exists, but needs verification #} + {% elif user.status == "needs_email_verification" %} + {% if user == request.user %} + {# this should only be visible when you are this user #} +

+

Verification needed

+ +

Almost done! Your account still needs to be verified.

+

+ An email should arrive in a few moments with instructions + on how to do so. +

+

In case it doesn't:

+ + Resend verification email +
+ {% else %} + {# if the user is not you, but still needs to verify their email #} +
+

Verification needed

+ +

+ Someone has registered an account with this username, but it + still has to be verified. +

+ +

+ If you are that person but you've lost your verification + email, you can + log in + and resend it. +

+
+ {% endif %} + + {# Active(?) (or at least verified at some point) user, horray! #} + {% else %}

{{ user.username }}'s profile

+
{% include "mediagoblin/utils/profile.html" %} {% if request.user['_id'] == user['_id'] or request.user['is_admin'] %} @@ -48,6 +75,7 @@ user.username }}">Edit profile {% endif %}
+
{% set pagination_base_url = user_gallery_url %} {% include "mediagoblin/utils/object_gallery.html" %} @@ -56,10 +84,7 @@ 'mediagoblin.user_pages.atom_feed', user=user.username) }}>atom feed
+
- #} - {% else %} - {# This *should* not occur as the view makes sure we pass in a user. #} -

Sorry, no such user found.

{% endif %} {% endblock %} diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index a3172ebd..57dcb555 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -32,10 +32,14 @@ from werkzeug.contrib.atom import AtomFeed def user_home(request, page): """'Homepage' of a User()""" user = request.db.User.find_one({ - 'username': request.matchdict['user'], - 'status': 'active'}) + 'username': request.matchdict['user']}) if not user: return exc.HTTPNotFound() + elif user['status'] != u'active': + return render_to_response( + request, + 'mediagoblin/user_pages/user.html', + {'user': user}) cursor = request.db.MediaEntry.find( {'uploader': user['_id'],