mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
Added logout button
Logout button was added to Web UI. Click on logout button executes session_logout command. If command succeeds or xhr stutus is 401 (unauthorized - already logged out) page is redirected to logout.html. logout.html is a simple page with "You have been logged out" text and a link to return back to main page. https://fedorahosted.org/freeipa/ticket/2363
This commit is contained in:
parent
a5a55ceff3
commit
87901ed709
@ -555,6 +555,7 @@ fi
|
||||
%{_usr}/share/ipa/migration/migration.py*
|
||||
%dir %{_usr}/share/ipa/ui
|
||||
%{_usr}/share/ipa/ui/index.html
|
||||
%{_usr}/share/ipa/ui/logout.html
|
||||
%{_usr}/share/ipa/ui/*.ico
|
||||
%{_usr}/share/ipa/ui/*.css
|
||||
%{_usr}/share/ipa/ui/*.js
|
||||
@ -674,6 +675,9 @@ fi
|
||||
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/ca.crt
|
||||
|
||||
%changelog
|
||||
* Wed Feb 29 2012 Petr Vobornik <pvoborni@redhat.com> - 2.99.0-20
|
||||
- Add Web UI logout page
|
||||
|
||||
* Mon Feb 27 2012 Rob Crittenden <rcritten@redhat.com> - 2.99.0-19
|
||||
- Add Requires to ipa-client on oddjob-mkhomedir
|
||||
|
||||
|
@ -38,6 +38,7 @@ app_DATA = \
|
||||
jquery.js \
|
||||
jquery.ordered-map.js \
|
||||
json2.js \
|
||||
logout.html \
|
||||
navigation.js \
|
||||
net.js \
|
||||
netgroup.js \
|
||||
|
@ -66,14 +66,17 @@
|
||||
|
||||
<div id="header">
|
||||
<span class="header-logo">
|
||||
<a href="#"><img src="images/ipa-logo.png" /><img src="images/ipa-banner.png" /></a>
|
||||
<a href="#"><img src="images/ipa-logo.png" /><img src="images/ipa-banner.png" /></a>
|
||||
</span>
|
||||
<span class="header-right">
|
||||
<span id="loggedinas" class="header-loggedinas">
|
||||
<a href="#"><span id="login_header">Logged in as</span>: <strong>user@FREEIPA.ORG</strong></a>
|
||||
<a href="#"><span id="login_header">Logged in as</span>: <strong>user@FREEIPA.ORG</strong></a>
|
||||
</span>
|
||||
<span class="header-loggedinas">
|
||||
| <a href="#logout" id="logout">Logout</a>
|
||||
</span>
|
||||
<span id="header-network-activity-indicator" class="network-activity-indicator">
|
||||
<img src="images/spinner-header.gif" />
|
||||
<img src="images/spinner-header.gif" />
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -295,7 +295,6 @@ IPA.get_credentials = function() {
|
||||
status = xhr.status;
|
||||
}
|
||||
|
||||
|
||||
function success_handler(data, text_status, xhr) {
|
||||
status = xhr.status;
|
||||
}
|
||||
@ -313,6 +312,51 @@ IPA.get_credentials = function() {
|
||||
return status;
|
||||
};
|
||||
|
||||
IPA.logout = function() {
|
||||
|
||||
function show_error(message) {
|
||||
var dialog = IPA.message_dialog({
|
||||
message: message,
|
||||
title: IPA.messages.login.logout_error
|
||||
});
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
function redirect () {
|
||||
window.location = 'logout.html';
|
||||
}
|
||||
|
||||
function success_handler(data, text_status, xhr) {
|
||||
if (data && data.error) {
|
||||
show_error(data.error.message);
|
||||
} else {
|
||||
redirect();
|
||||
}
|
||||
}
|
||||
|
||||
function error_handler(xhr, text_status, error_thrown) {
|
||||
if (xhr.status === 401) {
|
||||
redirect();
|
||||
} else {
|
||||
show_error(text_status);
|
||||
}
|
||||
}
|
||||
|
||||
var command = {
|
||||
method: 'session_logout',
|
||||
params: [[], {}]
|
||||
};
|
||||
|
||||
var request = {
|
||||
url: IPA.json_url || IPA.json_path + '/session_logout.json',
|
||||
data: JSON.stringify(command),
|
||||
success: success_handler,
|
||||
error: error_handler
|
||||
};
|
||||
|
||||
$.ajax(request);
|
||||
};
|
||||
|
||||
/**
|
||||
* Call an IPA command over JSON-RPC.
|
||||
*
|
||||
|
30
install/ui/logout.html
Normal file
30
install/ui/logout.html
Normal file
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>IPA: Identity Policy Audit</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="ipa.css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="info-page">
|
||||
|
||||
<div class="container_1">
|
||||
|
||||
<div class="header-logo">
|
||||
<img src="images/ipa-logo.png" /><img src="images/ipa-banner.png" />
|
||||
</div>
|
||||
|
||||
<div class="textblockkrb">
|
||||
<h1>You have been logged out</h1>
|
||||
<p>
|
||||
<a href="index.html">Return to main page.</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -110,7 +110,9 @@
|
||||
},
|
||||
"false": "False",
|
||||
"login": {
|
||||
"header": "Logged In As"
|
||||
"header": "Logged In As",
|
||||
"logout": "Logout",
|
||||
"logout_error": "Logout error"
|
||||
},
|
||||
"objects": {
|
||||
"aci": {
|
||||
|
7
install/ui/test/data/session_logout.json
Normal file
7
install/ui/test/data/session_logout.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"result": null
|
||||
}
|
||||
}
|
@ -170,6 +170,11 @@ $(function() {
|
||||
$('#loggedinas a').fragment(
|
||||
{'user-facet': 'details', 'user-pkey': IPA.whoami_pkey}, 2);
|
||||
|
||||
$('#logout').click(function() {
|
||||
IPA.logout();
|
||||
return false;
|
||||
}).text(IPA.messages.login.logout);
|
||||
|
||||
IPA.nav = create_navigation();
|
||||
IPA.nav.create();
|
||||
IPA.nav.update();
|
||||
|
@ -245,7 +245,9 @@ class i18n_messages(Command):
|
||||
},
|
||||
"false": _("False"),
|
||||
"login": {
|
||||
"header": _("Logged In As")
|
||||
"header": _("Logged In As"),
|
||||
"logout": _("Logout"),
|
||||
"logout_error": _("Logout error"),
|
||||
},
|
||||
"objects": {
|
||||
"aci": {
|
||||
|
Loading…
Reference in New Issue
Block a user