diff --git a/auth/auth_systems/google.py b/auth/auth_systems/google.py index 02953a3fc765331b32da62aed995caf3e600cb2e..0666498e87b004a08785a785f9e0861ff25cc7ea 100644 --- a/auth/auth_systems/google.py +++ b/auth/auth_systems/google.py @@ -40,7 +40,7 @@ def get_user_info_after_auth(request): else: name = email - return {'type' : 'google', 'user_id': email, 'name': name , 'info': {}, 'token':{}} + return {'type' : 'google', 'user_id': email, 'name': name , 'info': {'email': email}, 'token':{}} def do_logout(user): """ diff --git a/auth/auth_systems/twitter.py b/auth/auth_systems/twitter.py index 56ea1aba862cdde73bc108448dadb1d90b8567f1..a0ae9a0a4e470fe64161d958bdb20a00412282b7 100644 --- a/auth/auth_systems/twitter.py +++ b/auth/auth_systems/twitter.py @@ -86,6 +86,9 @@ def update_status(user_id, user_info, token, message): def send_message(user_id, user_name, user_info, subject, body): pass +def public_url(user_id): + return "http://twitter.com/%s" % user_id + def send_notification(user_id, user_info, message): twitter_client = _get_client_by_token(DM_TOKEN) result = twitter_client.oauth_request('http://api.twitter.com/1/direct_messages/new.json', args={'screen_name': user_id, 'text': message}, method='POST') diff --git a/auth/auth_systems/yahoo.py b/auth/auth_systems/yahoo.py index 48dd2464ddd7c0b57da09b839cd4983bd3c15cdc..dc29ab75ccb5a08b29a2aab1c806d9d647d496f6 100644 --- a/auth/auth_systems/yahoo.py +++ b/auth/auth_systems/yahoo.py @@ -27,7 +27,7 @@ def get_auth_url(request, redirect_url): def get_user_info_after_auth(request): data = view_helpers.finish_openid(request.session, request.GET, request.session['yahoo_redirect_url']) - return {'type' : 'yahoo', 'user_id': data['ax']['email'][0], 'name': data['ax']['fullname'][0], 'info': {}, 'token':{}} + return {'type' : 'yahoo', 'user_id': data['ax']['email'][0], 'name': data['ax']['fullname'][0], 'info': {'email': data['ax']['email'][0]}, 'token':{}} def do_logout(user): """ diff --git a/auth/models.py b/auth/models.py index 5b39a03f6df4c908409fd44b042add1ca2d66ad7..b09e873d8a166d047f73fad6884fa0b52207f32e 100644 --- a/auth/models.py +++ b/auth/models.py @@ -134,9 +134,24 @@ class User(models.Model): return self.user_id + @property + def public_url(self): + if AUTH_SYSTEMS.has_key(self.user_type): + if hasattr(AUTH_SYSTEMS[self.user_type], 'public_url'): + return AUTH_SYSTEMS[self.user_type].public_url(self.user_id) + + return None + def _display_html(self, size): + public_url = self.public_url + + if public_url: + name_display = '<a href="%s">%s</a>' % (public_url, self.pretty_name) + else: + name_display = self.pretty_name + return """<img border="0" height="%s" src="/static/auth/login-icons/%s.png" alt="%s" /> %s""" % ( - str(int(size)), self.user_type, self.user_type, self.pretty_name) + str(int(size)), self.user_type, self.user_type, name_display) @property def display_html_small(self): diff --git a/helios/templates/stats_elections.html b/helios/templates/stats_elections.html index 55a52523b1b131feb7a91c4b788eda207fc84a2f..7fe41331670b0464cb7682de3e4cc56901f0543d 100644 --- a/helios/templates/stats_elections.html +++ b/helios/templates/stats_elections.html @@ -18,7 +18,7 @@ Elections {{elections_page.start_index}} - {{elections_page.end_index}} &nb {% for election in elections %} <p> -<b><a href="{% url helios.views.one_election_view election.uuid %}">{{election.name}}</a></b> -- {{election.num_voters}} voters / {{election.num_cast_votes}} cast votes +<b><a href="{% url helios.views.one_election_view election.uuid %}">{{election.name}}</a></b> by <a href="mailto:{{election.admin.info.email}}">{{election.admin.pretty_name}}</a> -- {{election.num_voters}} voters / {{election.num_cast_votes}} cast votes </p> {% endfor %} diff --git a/helios/views.py b/helios/views.py index 286e7c8c4d08d7b428d8446e8bdf91a9beafde7d..38d533abe3f1962fd03ee2522135f83dc598b162 100644 --- a/helios/views.py +++ b/helios/views.py @@ -100,7 +100,7 @@ def get_voter(request, user, election): ## simple admin for development ## def admin_autologin(request): - if "localhost" not in settings.URL_HOST: + if "localhost" not in settings.URL_HOST and "127.0.0.1" not in settings.URL_HOST: raise Http404 users = User.objects.filter(admin_p=True)