Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
11 deletions
+42
-11
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
+19
-4
No files found.
circle/circle/settings/base.py
View file @
5e443754
...
@@ -339,7 +339,6 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
...
@@ -339,7 +339,6 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
'django.contrib.auth.backends.ModelBackend'
,
'django.contrib.auth.backends.ModelBackend'
,
'djangosaml2.backends.Saml2Backend'
,
'djangosaml2.backends.Saml2Backend'
,
)
)
LOGIN_URL
=
'/saml2/login/'
remote_metadata
=
join
(
SITE_ROOT
,
'remote_metadata.xml'
)
remote_metadata
=
join
(
SITE_ROOT
,
'remote_metadata.xml'
)
if
not
isfile
(
remote_metadata
):
if
not
isfile
(
remote_metadata
):
...
@@ -388,7 +387,7 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
...
@@ -388,7 +387,7 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
'DJANGO_SAML_GROUP_OWNER_ATTRIBUTES'
,
''
)
.
split
(
','
)
'DJANGO_SAML_GROUP_OWNER_ATTRIBUTES'
,
''
)
.
split
(
','
)
SAML_CREATE_UNKNOWN_USER
=
True
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
(
SAML_ORG_ID_ATTRIBUTE
=
get_env_variable
(
'DJANGO_SAML_ORG_ID_ATTRIBUTE'
)
'DJANGO_SAML_ORG_ID_ATTRIBUTE'
)
...
...
circle/circle/urls.py
View file @
5e443754
...
@@ -6,7 +6,8 @@ from django.shortcuts import redirect
...
@@ -6,7 +6,8 @@ from django.shortcuts import redirect
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
circle.settings.base
import
get_env_variable
from
circle.settings.base
import
get_env_variable
from
dashboard.forms
import
CircleAuthenticationForm
from
dashboard.views
import
circle_login
admin
.
autodiscover
()
admin
.
autodiscover
()
...
@@ -24,8 +25,7 @@ urlpatterns = patterns(
...
@@ -24,8 +25,7 @@ urlpatterns = patterns(
url
(
r'^admin/'
,
include
(
admin
.
site
.
urls
)),
url
(
r'^admin/'
,
include
(
admin
.
site
.
urls
)),
url
(
r'^network/'
,
include
(
'network.urls'
)),
url
(
r'^network/'
,
include
(
'network.urls'
)),
url
(
r'^dashboard/'
,
include
(
'dashboard.urls'
)),
url
(
r'^dashboard/'
,
include
(
'dashboard.urls'
)),
url
(
r'^accounts/login/?$'
,
'django.contrib.auth.views.login'
,
url
(
r'^accounts/login/?$'
,
circle_login
,
name
=
"accounts.login"
),
{
'authentication_form'
:
CircleAuthenticationForm
}),
url
(
r'^accounts/'
,
include
(
'django.contrib.auth.urls'
)),
url
(
r'^accounts/'
,
include
(
'django.contrib.auth.urls'
)),
)
)
...
...
circle/dashboard/views.py
View file @
5e443754
...
@@ -5,7 +5,9 @@ import re
...
@@ -5,7 +5,9 @@ import re
from
datetime
import
datetime
from
datetime
import
datetime
import
requests
import
requests
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.views
import
login
from
django.contrib.messages
import
warning
from
django.contrib.messages
import
warning
from
django.core.exceptions
import
(
from
django.core.exceptions
import
(
PermissionDenied
,
SuspiciousOperation
,
PermissionDenied
,
SuspiciousOperation
,
...
@@ -29,7 +31,7 @@ from braces.views import LoginRequiredMixin, SuperuserRequiredMixin
...
@@ -29,7 +31,7 @@ from braces.views import LoginRequiredMixin, SuperuserRequiredMixin
from
.forms
import
(
from
.forms
import
(
VmCustomizeForm
,
TemplateForm
,
LeaseForm
,
NodeForm
,
HostForm
,
VmCustomizeForm
,
TemplateForm
,
LeaseForm
,
NodeForm
,
HostForm
,
DiskAddForm
,
DiskAddForm
,
CircleAuthenticationForm
,
)
)
from
.tables
import
(
VmListTable
,
NodeListTable
,
NodeVmListTable
,
from
.tables
import
(
VmListTable
,
NodeListTable
,
NodeVmListTable
,
TemplateListTable
,
LeaseListTable
,
GroupListTable
,)
TemplateListTable
,
LeaseListTable
,
GroupListTable
,)
...
@@ -1718,3 +1720,12 @@ class VmMigrateView(SuperuserRequiredMixin, TemplateView):
...
@@ -1718,3 +1720,12 @@ class VmMigrateView(SuperuserRequiredMixin, TemplateView):
messages
.
error
(
self
.
request
,
_
(
"You didn't select a node!"
))
messages
.
error
(
self
.
request
,
_
(
"You didn't select a node!"
))
return
redirect
(
"
%
s#activity"
%
vm
.
get_absolute_url
())
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 @@
...
@@ -18,7 +18,7 @@
margin-top
:
40px
;
margin-top
:
40px
;
}
}
.container
{
.container
{
width
:
4
00px
;
width
:
6
00px
;
}
}
ul
,
li
{
ul
,
li
{
...
@@ -38,7 +38,13 @@
...
@@ -38,7 +38,13 @@
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
{
.login-form
{
margin-top
:
40px
;
padding
:
0
10px
;
padding
:
0
10px
;
}
}
...
...
circle/templates/registration/login.html
View file @
5e443754
...
@@ -4,17 +4,32 @@
...
@@ -4,17 +4,32 @@
{% get_current_language as LANGUAGE_CODE %}
{% get_current_language as LANGUAGE_CODE %}
{% block content %}
{% block content %}
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"login-form"
>
{% if form.password.errors or form.username.errors %}
{% if form.password.errors or form.username.errors %}
<div
class=
"login-form-errors"
>
{% include "display-form-errors.html" %}
{% include "display-form-errors.html" %}
</div>
{% endif %}
{% endif %}
<h3>
{% trans "Please login to continue!" %}
</h3>
<div
class=
"col-sm-6"
>
<div
class=
"login-form"
>
<form
action=
""
method=
"POST"
>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
{% csrf_token %}
{% crispy form %}
{% crispy form %}
</form>
</form>
<a
class=
"pull-right"
href=
""
>
Forgot your password?
</a>
</div>
</div>
</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 %}
{% 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