mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-29 04:40:55 +02:00
Add signup link, customize templates
This commit is contained in:
99
templates/cas_server/base.html
Normal file
99
templates/cas_server/base.html
Normal file
@ -0,0 +1,99 @@
|
||||
{% load i18n %}{% load static %}{% get_current_language as LANGUAGE_CODE %}<!DOCTYPE html>
|
||||
<html{% if LANGUAGE_CODE %} lang="{{LANGUAGE_CODE}}"{% endif %}>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge" /><![endif]-->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}{% trans "Central Authentication Service" %}{% endblock %}</title>
|
||||
<link href="{{settings.CAS_COMPONENT_URLS.bootstrap3_css}}" rel="stylesheet">
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="{{settings.CAS_COMPONENT_URLS.html5shiv}}"></script>
|
||||
<script src="{{settings.CAS_COMPONENT_URLS.respond}}"></script>
|
||||
<![endif]-->
|
||||
{% if settings.CAS_FAVICON_URL %}<link rel="shortcut icon" href="{{settings.CAS_FAVICON_URL}}" />{% endif %}
|
||||
<link href="{% static "cas_server/styles.css" %}" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div class="container">
|
||||
{% if auto_submit %}<noscript>{% endif %}
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<h1 id="app-name">
|
||||
{% if settings.CAS_LOGO_URL %}<img src="{{settings.CAS_LOGO_URL}}" alt="cas-logo" />{% endif %}
|
||||
Authentification Note Kfet 2020</h1>
|
||||
</div>
|
||||
</div>
|
||||
{% if auto_submit %}</noscript>{% endif %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-3 col-sm-2 col-xs-12"></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-8 col-xs-12">
|
||||
{% if auto_submit %}<noscript>{% endif %}
|
||||
{% for msg in CAS_INFO_RENDER %}
|
||||
<div class="alert alert-{{msg.type}}{% if msg.discardable %} alert-dismissable{% endif %}">
|
||||
{% if msg.discardable %}<button type="button" class="close" data-dismiss="alert" aria-hidden="true" id="info-{{msg.name}}">×</button>{% endif %}
|
||||
<p>{{msg.message}}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if settings.CAS_NEW_VERSION_HTML_WARNING and upgrade_available %}
|
||||
<div class="alert alert-info alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true" id="alert-version">×</button>
|
||||
<p>{% blocktrans %}A new version of the application is available. This instance runs {{VERSION}} and the last version is {{LAST_VERSION}}. Please consider upgrading.{% endblocktrans %}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block ante_messages %}{% endblock %}
|
||||
{% for message in messages %}
|
||||
<div {% spaceless %}
|
||||
{% if message.level == message_levels.DEBUG %}
|
||||
class="alert alert-warning"
|
||||
{% elif message.level == message_levels.INFO %}
|
||||
class="alert alert-info"
|
||||
{% elif message.level == message_levels.SUCCESS %}
|
||||
class="alert alert-success"
|
||||
{% elif message.level == message_levels.WARNING %}
|
||||
class="alert alert-warning"
|
||||
{% else %}
|
||||
class="alert alert-danger"
|
||||
{% endif %}
|
||||
{% endspaceless %}>
|
||||
<p>{{message}}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if auto_submit %}</noscript>{% endif %}
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-2 col-xs-0"></div>
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
{% if settings.CAS_SHOW_POWERED %}
|
||||
<div id="footer">
|
||||
<p><a class="text-muted" href="https://pypi.org/project/django-cas-server/">django-cas-server powered</a></p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<script src="{{settings.CAS_COMPONENT_URLS.jquery}}"></script>
|
||||
<script src="{{settings.CAS_COMPONENT_URLS.bootstrap3_js}}"></script>
|
||||
<script src="{% static "cas_server/functions.js" %}"></script>
|
||||
<script type="text/javascript">
|
||||
{% if settings.CAS_NEW_VERSION_HTML_WARNING and upgrade_available %}
|
||||
discard_and_remember("#alert-version", "cas-alert-version", "{{LAST_VERSION}}");
|
||||
{% endif %}
|
||||
{% for msg in CAS_INFO_RENDER %}
|
||||
{% if msg.discardable %}
|
||||
discard_and_remember("#info-{{msg.name}}", "cas-info-{{msg.name}}", "{{msg.hash}}");
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% block javascript_inline %}{% endblock %}
|
||||
</script>
|
||||
{% block javascript %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
<!--
|
||||
Powered by django-cas-server version {{VERSION}}
|
||||
|
||||
Pypi: https://pypi.org/project/django-cas-server/
|
||||
github: https://github.com/nitmir/django-cas-server
|
||||
-->
|
26
templates/cas_server/form.html
Normal file
26
templates/cas_server/form.html
Normal file
@ -0,0 +1,26 @@
|
||||
{% load cas_server %}
|
||||
{% for error in form.non_field_errors %}
|
||||
<div class="alert alert-danger alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{{error}}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% for field in form %}{% if not field|is_hidden %}
|
||||
<div class="form-group
|
||||
{% if not form.non_field_errors %}
|
||||
{% if field.errors %} has-error
|
||||
{% elif form.cleaned_data %} has-success
|
||||
{% endif %}
|
||||
{% endif %}"
|
||||
>{% spaceless %}
|
||||
{% if field|is_checkbox %}
|
||||
<div class="checkbox"><label for="{{field.auto_id}}">{{field}}{{field.label}}</label></div>
|
||||
{% else %}
|
||||
<label class="control-label" for="{{field.auto_id}}">{{field.label}}</label>
|
||||
{{field}}
|
||||
{% endif %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{error}}</span>
|
||||
{% endfor %}
|
||||
{% endspaceless %}</div>
|
||||
{% else %}{{field}}{% endif %}{% endfor %}
|
21
templates/cas_server/logged.html
Normal file
21
templates/cas_server/logged.html
Normal file
@ -0,0 +1,21 @@
|
||||
{% extends "cas_server/base.html" %}
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="alert alert-success" role="alert">{% blocktrans %}<h3>Log In Successful</h3>You have successfully logged into the Central Authentication Service.<br/>For security reasons, please Log Out and Exit your web browser when you are done accessing services that require authentication!{% endblocktrans %}</div>
|
||||
<form class="form-signin" method="get" action="logout">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="all" value="1">{% trans "Log me out from all my sessions" %}
|
||||
</label>
|
||||
</div>
|
||||
{% if settings.CAS_FEDERATE and request.COOKIES.remember_provider %}
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="forget_provider" value="1">{% trans "Forget the identity provider" %}
|
||||
</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button class="btn btn-danger btn-block btn-lg" type="submit">{% trans "Logout" %}</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
33
templates/cas_server/login.html
Normal file
33
templates/cas_server/login.html
Normal file
@ -0,0 +1,33 @@
|
||||
{% extends "cas_server/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block ante_messages %}
|
||||
{% if auto_submit %}<noscript>{% endif %}
|
||||
<h2 class="form-signin-heading">{% trans "Please log in" %}</h2>
|
||||
{% if auto_submit %}</noscript>{% endif %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "If you don't have any Note Kfet account, please follow <a href='/accounts/signup'>this link to sign up</a>." %}
|
||||
</div>
|
||||
<form class="form-signin" method="post" id="login_form"{% if post_url %} action="{{post_url}}"{% endif %}>
|
||||
{% csrf_token %}
|
||||
{% include "cas_server/form.html" %}
|
||||
{% if auto_submit %}<noscript>{% endif %}
|
||||
<button class="btn btn-primary btn-block btn-lg" type="submit">{% trans "Login" %}</button>
|
||||
{% if auto_submit %}</noscript>{% endif %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% block javascript_inline %}
|
||||
jQuery(function( $ ){
|
||||
$("#id_warn").click(function(e){
|
||||
if($("#id_warn").is(':checked')){
|
||||
createCookie("warn", "on", 10 * 365);
|
||||
} else {
|
||||
eraseCookie("warn");
|
||||
}
|
||||
});
|
||||
});{% if auto_submit %}
|
||||
document.getElementById('login_form').submit(); // SUBMIT FORM{% endif %}
|
||||
{% endblock %}
|
||||
|
7
templates/cas_server/logout.html
Normal file
7
templates/cas_server/logout.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends "cas_server/base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="alert alert-success" role="alert">{{logout_msg}}</div>
|
||||
{% endblock %}
|
||||
|
5
templates/cas_server/proxy.xml
Normal file
5
templates/cas_server/proxy.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
|
||||
<cas:proxySuccess>
|
||||
<cas:proxyTicket>{{ticket}}</cas:proxyTicket>
|
||||
</cas:proxySuccess>
|
||||
</cas:serviceResponse>
|
59
templates/cas_server/samlValidate.xml
Normal file
59
templates/cas_server/samlValidate.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<SOAP-ENV:Header />
|
||||
<SOAP-ENV:Body>
|
||||
<Response xmlns="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
|
||||
xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" IssueInstant="{{IssueInstant}}"
|
||||
MajorVersion="1" MinorVersion="1" Recipient="{{Recipient}}"
|
||||
ResponseID="{{ResponseID}}">
|
||||
<Status>
|
||||
<StatusCode Value="samlp:Success">
|
||||
</StatusCode>
|
||||
</Status>
|
||||
<Assertion xmlns="urn:oasis:names:tc:SAML:1.0:assertion" AssertionID="{{ResponseID}}"
|
||||
IssueInstant="{{IssueInstant}}" Issuer="localhost" MajorVersion="1"
|
||||
MinorVersion="1">
|
||||
<Conditions NotBefore="{{IssueInstant}}" NotOnOrAfter="{{expireInstant}}">
|
||||
<AudienceRestrictionCondition>
|
||||
<Audience>
|
||||
{{Recipient}}
|
||||
</Audience>
|
||||
</AudienceRestrictionCondition>
|
||||
</Conditions>
|
||||
<AttributeStatement>
|
||||
<Subject>
|
||||
<NameIdentifier>{{username}}</NameIdentifier>
|
||||
<SubjectConfirmation>
|
||||
<ConfirmationMethod>
|
||||
urn:oasis:names:tc:SAML:1.0:cm:artifact
|
||||
</ConfirmationMethod>
|
||||
</SubjectConfirmation>
|
||||
</Subject>
|
||||
<Attribute AttributeName="authenticationDate" AttributeNamespace="http://www.ja-sig.org/products/cas/">
|
||||
<AttributeValue>{{auth_date}}</AttributeValue>
|
||||
</Attribute>
|
||||
<Attribute AttributeName="longTermAuthenticationRequestTokenUsed" AttributeNamespace="http://www.ja-sig.org/products/cas/">
|
||||
<AttributeValue>false</AttributeValue>{# we do not support long-term (Remember-Me) auth #}
|
||||
</Attribute>
|
||||
<Attribute AttributeName="isFromNewLogin" AttributeNamespace="http://www.ja-sig.org/products/cas/">
|
||||
<AttributeValue>{{is_new_login}}</AttributeValue>
|
||||
</Attribute>
|
||||
{% for name, value in attributes %} <Attribute AttributeName="{{name}}" AttributeNamespace="http://www.ja-sig.org/products/cas/">
|
||||
<AttributeValue>{{value}}</AttributeValue>
|
||||
</Attribute>
|
||||
{% endfor %} </AttributeStatement>
|
||||
<AuthenticationStatement AuthenticationInstant="{{IssueInstant}}"
|
||||
AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:password">
|
||||
<Subject>
|
||||
<NameIdentifier>{{username}}</NameIdentifier>
|
||||
<SubjectConfirmation>
|
||||
<ConfirmationMethod>
|
||||
urn:oasis:names:tc:SAML:1.0:cm:artifact
|
||||
</ConfirmationMethod>
|
||||
</SubjectConfirmation>
|
||||
</Subject>
|
||||
</AuthenticationStatement>
|
||||
</Assertion>
|
||||
</Response>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
14
templates/cas_server/samlValidateError.xml
Normal file
14
templates/cas_server/samlValidateError.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<SOAP-ENV:Header />
|
||||
<SOAP-ENV:Body>
|
||||
<Response xmlns="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
|
||||
xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" IssueInstant="{{IssueInstant}}"
|
||||
MajorVersion="1" MinorVersion="1" Recipient="{{Recipient}}"
|
||||
ResponseID="{{ResponseID}}">
|
||||
<Status>
|
||||
<StatusCode Value="samlp:{{code}}">{{msg}}</StatusCode>
|
||||
</Status>
|
||||
</Response>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
19
templates/cas_server/serviceValidate.xml
Normal file
19
templates/cas_server/serviceValidate.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
|
||||
<cas:authenticationSuccess>
|
||||
<cas:user>{{username}}</cas:user>
|
||||
<cas:attributes>
|
||||
<cas:authenticationDate>{{auth_date}}</cas:authenticationDate>
|
||||
<cas:longTermAuthenticationRequestTokenUsed>false</cas:longTermAuthenticationRequestTokenUsed>{# we do not support long-term (Remember-Me) auth #}
|
||||
<cas:isFromNewLogin>{{is_new_login}}</cas:isFromNewLogin>
|
||||
{% for key, value in attributes %} <cas:{{key}}>{{value}}</cas:{{key}}>
|
||||
{% endfor %} </cas:attributes>
|
||||
<cas:attribute name="authenticationDate" value="{{auth_date}}"/>
|
||||
<cas:attribute name="longTermAuthenticationRequestTokenUsed" value="false"/>
|
||||
<cas:attribute name="isFromNewLogin" value="{{is_new_login}}"/>
|
||||
{% for key, value in attributes %} <cas:attribute name="{{key}}" value="{{value}}"/>
|
||||
{% endfor %}{% if proxyGrantingTicket %} <cas:proxyGrantingTicket>{{proxyGrantingTicket}}</cas:proxyGrantingTicket>
|
||||
{% endif %}{% if proxies %} <cas:proxies>
|
||||
{% for proxy in proxies %} <cas:proxy>{{proxy}}</cas:proxy>
|
||||
{% endfor %} </cas:proxies>
|
||||
{% endif %} </cas:authenticationSuccess>
|
||||
</cas:serviceResponse>
|
3
templates/cas_server/serviceValidateError.xml
Normal file
3
templates/cas_server/serviceValidateError.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
|
||||
<cas:authenticationFailure code="{{code}}">{{msg}}</cas:authenticationFailure>
|
||||
</cas:serviceResponse>
|
11
templates/cas_server/warn.html
Normal file
11
templates/cas_server/warn.html
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends "cas_server/base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<form class="form-signin" method="post">
|
||||
{% csrf_token %}
|
||||
{% include "cas_server/form.html" %}
|
||||
<button class="btn btn-primary btn-block btn-lg" type="submit">{% trans "Connect to the service" %}</button>
|
||||
</form>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user