Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5e0a765a
authored
Aug 10, 2016
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: nicer 2fa login page
parent
b83e5628
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
15 deletions
+37
-15
circle/dashboard/forms.py
+2
-3
circle/dashboard/static/dashboard/dashboard.less
+14
-0
circle/dashboard/views/user.py
+10
-4
circle/templates/registration/two-factor-login.html
+11
-8
No files found.
circle/dashboard/forms.py
View file @
5e0a765a
...
...
@@ -1670,9 +1670,8 @@ class TwoFactorForm(ModelForm):
class
TwoFactorConfirmationForm
(
forms
.
Form
):
confirmation_code
=
forms
.
CharField
(
label
=
_
(
'Confirmation code'
),
help_text
=
_
(
"Get the code from your authenticator to disable "
"two-factor authentication."
))
label
=
_
(
'Two-factor authentication passcode'
),
help_text
=
_
(
"Get the code from your authenticator."
))
def
__init__
(
self
,
user
,
*
args
,
**
kwargs
):
self
.
user
=
user
...
...
circle/dashboard/static/dashboard/dashboard.less
View file @
5e0a765a
...
...
@@ -1549,3 +1549,17 @@ textarea[name="new_members"] {
margin-left: 15px;
}
}
#two-factor-box {
.help-block {
display: block;
}
h4 {
margin: 0;
}
hr {
margin: 15px 0 2px 0;
}
}
circle/dashboard/views/user.py
View file @
5e0a765a
...
...
@@ -622,15 +622,21 @@ class TwoFactorLoginView(FormView):
return
super
(
TwoFactorLoginView
,
self
)
.
dispatch
(
*
args
,
**
kwargs
)
def
get_user
(
self
):
return
User
.
objects
.
get
(
pk
=
self
.
request
.
session
[
'two-fa-user'
])
def
get_form_kwargs
(
self
):
kwargs
=
super
(
TwoFactorLoginView
,
self
)
.
get_form_kwargs
()
user_pk
=
self
.
request
.
session
[
'two-fa-user'
]
kwargs
[
'user'
]
=
User
.
objects
.
get
(
pk
=
user_pk
)
kwargs
[
'user'
]
=
self
.
get_user
()
return
kwargs
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
TwoFactorLoginView
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
[
'user'
]
=
self
.
get_user
()
return
ctx
def
form_valid
(
self
,
form
):
user_pk
=
self
.
request
.
session
[
'two-fa-user'
]
user
=
User
.
objects
.
get
(
pk
=
user_pk
)
user
=
self
.
get_user
()
if
self
.
request
.
session
[
'login-type'
]
==
"saml2"
:
user
.
backend
=
'common.backends.Saml2Backend'
...
...
circle/templates/registration/two-factor-login.html
View file @
5e0a765a
...
...
@@ -4,21 +4,24 @@
{% load crispy_forms_tags %}
{% get_current_language as LANGUAGE_CODE %}
{% block title-page %}{% trans "
Logi
n" %}{% endblock %}
{% block title-page %}{% trans "
Two-factor authenticatio
n" %}{% endblock %}
{% block content_box %}
<div
class=
"row"
>
<div
class=
"row"
id=
"two-factor-box"
>
<div
class=
"col-md-12"
>
<h4>
{% blocktrans with username=user.username full_name=user.get_full_name %}
Welcome {{ full_name }} ({{ username }})!
{% endblocktrans %}
</h4>
<hr/>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
{{ form.confirmation_code|as_crispy_field }}
<input
type=
"submit"
/>
<button
type=
"submit"
class=
"btn btn-success"
>
{% trans "Confirm" %}
</button>
</form>
</div>
</div>
<style>
.help-block
{
display
:
block
;
}
</style>
{% endblock %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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