From b95adc9ee5a57162ac383e7847c72a462371cfb9 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Tue, 27 Jan 2009 14:29:44 +0100 Subject: [PATCH] Turn the logic around warnings for missing SSH keys around, so we don't show the warning to users that aren't logged in. --- gitadmin/adm/templates/base.html | 2 +- gitadmin/adm/views.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gitadmin/adm/templates/base.html b/gitadmin/adm/templates/base.html index 95e779a..b668b4c 100644 --- a/gitadmin/adm/templates/base.html +++ b/gitadmin/adm/templates/base.html @@ -21,7 +21,7 @@ {%if user.is_superuser %}

You are registered as an administrator. BE CAREFUL!

{% endif %} -{%if not has_sshkey %} +{%if missing_sshkey %}

Note! Your ssh key has not yet been registered with the system, or it has not yet replicated from the main server. Please upload your keys using the community account system.

diff --git a/gitadmin/adm/views.py b/gitadmin/adm/views.py index f4c3684..effc67c 100644 --- a/gitadmin/adm/views.py +++ b/gitadmin/adm/views.py @@ -12,19 +12,22 @@ from gitadmin.adm.forms import * # Utility functions -def _HasSshkey(userid): +def _MissingSshkey(user): + if not user.is_authenticated(): + print "Not auth" + return False try: - gu = GitUser.objects.get(userid=userid) + gu = GitUser.objects.get(userid=user.username) if gu.sshkey != '': - return True - else: return False + else: + return True except: - return False + return True def context_add(request): return { - 'has_sshkey': _HasSshkey(request.user.username), + 'missing_sshkey': _MissingSshkey(request.user), } # Views -- 2.39.5