Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mattia Rizzolo
nm.debian.org
Commits
6925c10a
Unverified
Commit
6925c10a
authored
Apr 21, 2020
by
Enrico Zini
Browse files
Fixed whoami template. Closes:
#4
parents
3731aa30
1f4dea0b
Changes
3
Hide whitespace changes
Inline
Side-by-side
wizard/templates/wizard/whoami.html
View file @
6925c10a
...
...
@@ -2,25 +2,50 @@
<div
class=
"card"
>
<div
class=
"card-body"
>
{% if request.s
so_username
%}
{% if request.s
ignon_identities
%}
{% if visitor %}
{% blocktrans with request_user_username=request.user.username visitor_a_link=visitor.a_link %}You
are currently logged in with
<a
href=
"https://wiki.debian.org/DebianSingleSignOn"
>
SSO username
</a>
<b>
{{request_user_username}}
</b>
, and recognized as {{visitor_a_link}}.{% endblocktrans %}
{% blocktrans with visitor_a_link=visitor.a_link %}
You are currently logged in, and recognized as {{visitor_a_link}}.
{% endblocktrans %}
{% else %}
{% url 'dm_claim' as dm_claim_url %}
{% blocktrans with request_user_username=request.user.username %}You
are currently logged in with
<a
href=
"https://wiki.debian.org/DebianSingleSignOn"
>
SSO username
</a>
<b>
{{request_user_username}}
</b>
, but not mapped to any person in the site.
are currently logged in, but not mapped to any person in the site.
If you are a Debian Maintainer, you can try to correct the situation using the
<a
href=
"{{dm_claim}}"
>
claim interface
</a>
.{% endblocktrans %}
<p>
{% trans "You are logged in as:" %}
</p>
<ul>
{% for identity in request.signon_identities.values %}
<li>
{% with identity.get_provider as provider %}
{% if identity.picture %}
<img
class=
"personpic ml-auto"
src=
"{{identity.picture}}"
></img>
{% elif provider.icon %}
<img
style=
"vertical-align: text-top; height: 1em"
class=
"mr-2"
src=
"{{STATIC_URL}}{{provider.icon}}"
></img>
{% else %}
<span
class=
"mr-2 fa fa-sign-in"
></span>
{% endif %}
{% if identity.profile %}
<a
href=
"{{identity.profile}}"
>
{% endif %}
{{provider.label}}:
{{identity.fullname}}{% if identity.username %}
<
{{identity.username}}
>
{% endif %}
{% if identity.profile %}
</a>
{% endif %}
{% endwith %}
</li>
{% endfor %}
</ul>
{% endif %}
{% else %}
{% blocktrans %}You are not currently logged in. See the
<a
href=
"https://wiki.debian.org/DebianSingleSignOn"
>
Single Sign-On page
</a>
for details.{% endblocktrans %}
{% endif %}
</div>
</div>
wizard/tests/test_advocate.py
View file @
6925c10a
...
...
@@ -5,7 +5,7 @@ from backend import const
from
backend.unittest
import
PersonFixtureMixin
class
PersonPag
eTest
Case
(
PersonFixtureMixin
,
TestCase
):
class
Advocat
eTest
s
(
PersonFixtureMixin
,
TestCase
):
@
classmethod
def
setUpClass
(
cls
):
super
().
setUpClass
()
...
...
wizard/tests/test_whoami.py
0 → 100644
View file @
6925c10a
from
__future__
import
annotations
from
django.test
import
TestCase
from
django.urls
import
reverse
from
backend
import
const
from
backend.unittest
import
PersonFixtureMixin
from
signon.models
import
Identity
class
WhoamiTests
(
PersonFixtureMixin
,
TestCase
):
def
test_notlogged
(
self
):
# Check that the new person is listed on the page
client
=
self
.
make_test_client
(
None
)
response
=
client
.
get
(
reverse
(
'wizard_home'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"You are not currently logged in."
)
self
.
assertNotContains
(
response
,
"but not mapped to any person in the site."
)
self
.
assertNotContains
(
response
,
"You are currently logged in, and recognized as"
)
def
test_active_unbound
(
self
):
# Check that the new person is listed on the page
identity
=
Identity
.
objects
.
create
(
issuer
=
"debsso"
,
subject
=
"test@debian.org"
,
username
=
"test@debian.org"
,
audit_skip
=
True
)
client
=
self
.
make_test_client
(
None
,
[
identity
])
response
=
client
.
get
(
reverse
(
'wizard_home'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertNotContains
(
response
,
"You are not currently logged in."
)
self
.
assertContains
(
response
,
"but not mapped to any person in the site."
)
self
.
assertNotContains
(
response
,
"You are currently logged in, and recognized as"
)
def
test_active_bound
(
self
):
# Check that the new person is listed on the page
identity
=
Identity
.
objects
.
create
(
person
=
self
.
persons
.
dc
,
issuer
=
"debsso"
,
subject
=
"test@debian.org"
,
username
=
"test@debian.org"
,
audit_skip
=
True
)
client
=
self
.
make_test_client
(
self
.
persons
.
dc
,
[
identity
])
response
=
client
.
get
(
reverse
(
'wizard_home'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertNotContains
(
response
,
"You are not currently logged in."
)
self
.
assertNotContains
(
response
,
"but not mapped to any person in the site."
)
self
.
assertContains
(
response
,
"You are currently logged in, and recognized as"
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment