summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to 'install')
-rw-r--r--install/ui/Makefile.am1
-rw-r--r--install/ui/index.html9
-rw-r--r--install/ui/ipa.js46
-rw-r--r--install/ui/logout.html30
-rw-r--r--install/ui/test/data/ipa_init.json4
-rw-r--r--install/ui/test/data/session_logout.json7
-rw-r--r--install/ui/webui.js5
7 files changed, 97 insertions, 5 deletions
diff --git a/install/ui/Makefile.am b/install/ui/Makefile.am
index d87a0944c..a4d083ac0 100644
--- a/install/ui/Makefile.am
+++ b/install/ui/Makefile.am
@@ -38,6 +38,7 @@ app_DATA = \
jquery.js \
jquery.ordered-map.js \
json2.js \
+ logout.html \
navigation.js \
net.js \
netgroup.js \
diff --git a/install/ui/index.html b/install/ui/index.html
index db314331a..6b1be869b 100644
--- a/install/ui/index.html
+++ b/install/ui/index.html
@@ -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>
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index d1bb04210..0afa4f097 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -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.
*
diff --git a/install/ui/logout.html b/install/ui/logout.html
new file mode 100644
index 000000000..e356d2a5f
--- /dev/null
+++ b/install/ui/logout.html
@@ -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>
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 29880b2eb..e5b4be169 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -110,7 +110,9 @@
},
"false": "False",
"login": {
- "header": "Logged In As"
+ "header": "Logged In As",
+ "logout": "Logout",
+ "logout_error": "Logout error"
},
"objects": {
"aci": {
diff --git a/install/ui/test/data/session_logout.json b/install/ui/test/data/session_logout.json
new file mode 100644
index 000000000..13410c6e2
--- /dev/null
+++ b/install/ui/test/data/session_logout.json
@@ -0,0 +1,7 @@
+{
+ "error": null,
+ "id": null,
+ "result": {
+ "result": null
+ }
+} \ No newline at end of file
diff --git a/install/ui/webui.js b/install/ui/webui.js
index b8394d289..5d32e7977 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -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();