Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5e443754
authored
Mar 03, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: new login with saml2
parent
cda740cf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
13 deletions
+44
-13
circle/circle/settings/base.py
+1
-2
circle/circle/urls.py
+3
-3
circle/dashboard/views.py
+12
-1
circle/templates/registration/base.html
+7
-1
circle/templates/registration/login.html
+21
-6
No files found.
circle/circle/settings/base.py
View file @
5e443754
...
...
@@ -339,7 +339,6 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
'django.contrib.auth.backends.ModelBackend'
,
'djangosaml2.backends.Saml2Backend'
,
)
LOGIN_URL
=
'/saml2/login/'
remote_metadata
=
join
(
SITE_ROOT
,
'remote_metadata.xml'
)
if
not
isfile
(
remote_metadata
):
...
...
@@ -388,7 +387,7 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
'DJANGO_SAML_GROUP_OWNER_ATTRIBUTES'
,
''
)
.
split
(
','
)
SAML_CREATE_UNKNOWN_USER
=
True
if
get_env_variable
(
'DJANGO_SAML_ORG_ID_ATTRIBUTE'
,
False
)
!=
False
:
if
get_env_variable
(
'DJANGO_SAML_ORG_ID_ATTRIBUTE'
,
False
)
is
not
False
:
SAML_ORG_ID_ATTRIBUTE
=
get_env_variable
(
'DJANGO_SAML_ORG_ID_ATTRIBUTE'
)
...
...
circle/circle/urls.py
View file @
5e443754
...
...
@@ -6,7 +6,8 @@ from django.shortcuts import redirect
from
django.core.urlresolvers
import
reverse
from
circle.settings.base
import
get_env_variable
from
dashboard.forms
import
CircleAuthenticationForm
from
dashboard.views
import
circle_login
admin
.
autodiscover
()
...
...
@@ -24,8 +25,7 @@ urlpatterns = patterns(
url
(
r'^admin/'
,
include
(
admin
.
site
.
urls
)),
url
(
r'^network/'
,
include
(
'network.urls'
)),
url
(
r'^dashboard/'
,
include
(
'dashboard.urls'
)),
url
(
r'^accounts/login/?$'
,
'django.contrib.auth.views.login'
,
{
'authentication_form'
:
CircleAuthenticationForm
}),
url
(
r'^accounts/login/?$'
,
circle_login
,
name
=
"accounts.login"
),
url
(
r'^accounts/'
,
include
(
'django.contrib.auth.urls'
)),
)
...
...
circle/dashboard/views.py
View file @
5e443754
...
...
@@ -5,7 +5,9 @@ import re
from
datetime
import
datetime
import
requests
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.views
import
login
from
django.contrib.messages
import
warning
from
django.core.exceptions
import
(
PermissionDenied
,
SuspiciousOperation
,
...
...
@@ -29,7 +31,7 @@ from braces.views import LoginRequiredMixin, SuperuserRequiredMixin
from
.forms
import
(
VmCustomizeForm
,
TemplateForm
,
LeaseForm
,
NodeForm
,
HostForm
,
DiskAddForm
,
DiskAddForm
,
CircleAuthenticationForm
,
)
from
.tables
import
(
VmListTable
,
NodeListTable
,
NodeVmListTable
,
TemplateListTable
,
LeaseListTable
,
GroupListTable
,)
...
...
@@ -1718,3 +1720,12 @@ class VmMigrateView(SuperuserRequiredMixin, TemplateView):
messages
.
error
(
self
.
request
,
_
(
"You didn't select a node!"
))
return
redirect
(
"
%
s#activity"
%
vm
.
get_absolute_url
())
def
circle_login
(
request
):
authentication_form
=
CircleAuthenticationForm
extra_context
=
{
'saml2'
:
getattr
(
settings
,
"SAML_CONFIG"
,
False
)
}
return
login
(
request
,
authentication_form
=
authentication_form
,
extra_context
=
extra_context
)
circle/templates/registration/base.html
View file @
5e443754
...
...
@@ -18,7 +18,7 @@
margin-top
:
40px
;
}
.container
{
width
:
4
00px
;
width
:
6
00px
;
}
ul
,
li
{
...
...
@@ -37,8 +37,14 @@
-moz-box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,
.15
);
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,
.15
);
}
.login-form-errors
.alert
{
margin-right
:
30px
;
margin-left
:
30px
;
}
.login-form
{
margin-top
:
40px
;
padding
:
0
10px
;
}
...
...
circle/templates/registration/login.html
View file @
5e443754
...
...
@@ -4,17 +4,32 @@
{% get_current_language as LANGUAGE_CODE %}
{% block content %}
<div
class=
"row"
>
<div
class=
"login-form"
>
{% if form.password.errors or form.username.errors %}
<div
class=
"row"
>
{% if form.password.errors or form.username.errors %}
<div
class=
"login-form-errors"
>
{% include "display-form-errors.html" %}
{% endif %}
<h3>
{% trans "Please login to continue!" %}
</h3>
</div>
{% endif %}
<div
class=
"col-sm-6"
>
<div
class=
"login-form"
>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
{% crispy form %}
</form>
<a
class=
"pull-right"
href=
""
>
Forgot your password?
</a>
</div>
</div>
<div
class=
"col-sm-6"
>
<h4
style=
"padding-top: 0; margin-top: 0;"
>
Login with eduID
</h4>
{% if saml2 %}
<a
href=
"{% url "
saml2_login
"
%}"
>
Click here!
</a>
{% else %}
{% trans "SAML2 NOT AVAILABLE" %}
{% endif %}
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<a
class=
"pull-right"
href=
""
>
Forgot your password?
</a>
</div>
</div>
{% 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