summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Voborník <pvoborni@redhat.com>2012-02-27 15:31:20 +0100
committerPetr Vobornik <pvoborni@redhat.com>2012-03-02 11:04:33 +0100
commit368c624a7445f6d3a34993a3835026bb383506e4 (patch)
tree86314eb4ba98b14a317f72a80fd17f210c6d9207
parent95b85f6384637e6c5c79a8567de3583e7d3af046 (diff)
downloadfreeipa-368c624a7445f6d3a34993a3835026bb383506e4.tar.gz
freeipa-368c624a7445f6d3a34993a3835026bb383506e4.tar.xz
freeipa-368c624a7445f6d3a34993a3835026bb383506e4.zip
Forms based authentication UI
Support for forms based authentication was added to UI. It consist of: 1) new login page Page url is [ipa server]/ipa/ui/login.html Page contains a login form. For authentication it sends ajax request at [ipa server]/session/json/login_password. If authentication is successfull page is redirected to [ipa server]/ipa/ui if it fails from whatever reason a message is shown. 2) new enhanced error dialog - authorization_dialog. This dialog is displayed when user is not authorized to perform action - usually when ticket and session expires. It is a standard error dialog which shows kerberos ticket related error message and newly offers (as a link) to use form based authentication. If user click on the link, the dialog content and buttons switch to login dialog which has same functionality as 'new login page'. User is able to return back to the error message by clicking on a back button. login.html uses same css styles as migration page -> ipa-migration.css was merged into ipa.css. https://fedorahosted.org/freeipa/ticket/2450
-rw-r--r--freeipa.spec.in6
-rw-r--r--install/migration/Makefile.am1
-rw-r--r--install/migration/error.html1
-rw-r--r--install/migration/index.html1
-rw-r--r--install/migration/invalid.html5
-rw-r--r--install/migration/ipa_migration.css96
-rw-r--r--install/ui/Makefile.am2
-rw-r--r--install/ui/dialog.js39
-rw-r--r--install/ui/field.js6
-rw-r--r--install/ui/ipa.css99
-rw-r--r--install/ui/ipa.js289
-rw-r--r--install/ui/jsl.conf1
-rw-r--r--install/ui/login.html51
-rw-r--r--install/ui/login.js76
-rw-r--r--install/ui/test/data/ipa_init.json8
-rw-r--r--install/ui/widget.js1
-rw-r--r--ipalib/plugins/internal.py6
17 files changed, 527 insertions, 161 deletions
diff --git a/freeipa.spec.in b/freeipa.spec.in
index 90c8e9f8d..fc5370b37 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -551,10 +551,10 @@ fi
%{_usr}/share/ipa/migration/error.html
%{_usr}/share/ipa/migration/index.html
%{_usr}/share/ipa/migration/invalid.html
-%{_usr}/share/ipa/migration/ipa_migration.css
%{_usr}/share/ipa/migration/migration.py*
%dir %{_usr}/share/ipa/ui
%{_usr}/share/ipa/ui/index.html
+%{_usr}/share/ipa/ui/login.html
%{_usr}/share/ipa/ui/logout.html
%{_usr}/share/ipa/ui/*.ico
%{_usr}/share/ipa/ui/*.css
@@ -675,6 +675,10 @@ 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-21
+- Add Web UI form based login page
+- Removed ipa_migration.css
+
* Wed Feb 29 2012 Petr Vobornik <pvoborni@redhat.com> - 2.99.0-20
- Add Web UI logout page
diff --git a/install/migration/Makefile.am b/install/migration/Makefile.am
index aa5713640..b90578015 100644
--- a/install/migration/Makefile.am
+++ b/install/migration/Makefile.am
@@ -5,7 +5,6 @@ app_DATA = \
error.html \
index.html \
invalid.html \
- ipa_migration.css \
migration.py \
$(NULL)
diff --git a/install/migration/error.html b/install/migration/error.html
index 85ff4c1f6..9e1e3bd0b 100644
--- a/install/migration/error.html
+++ b/install/migration/error.html
@@ -6,7 +6,6 @@
<link rel="stylesheet" type="text/css" href="../ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="../ui/ipa.css" />
- <link rel="stylesheet" type="text/css" href="ipa_migration.css" />
</head>
<body class="info-page">
diff --git a/install/migration/index.html b/install/migration/index.html
index 908162b89..eb816b35d 100644
--- a/install/migration/index.html
+++ b/install/migration/index.html
@@ -6,7 +6,6 @@
<link rel="stylesheet" type="text/css" href="../ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="../ui/ipa.css" />
- <link rel="stylesheet" type="text/css" href="ipa_migration.css" />
</head>
<body class="info-page">
diff --git a/install/migration/invalid.html b/install/migration/invalid.html
index d1ba60ac4..4f4693406 100644
--- a/install/migration/invalid.html
+++ b/install/migration/invalid.html
@@ -4,9 +4,8 @@
<meta charset="utf-8">
<title>IPA: Identity Policy Audit</title>
- <link rel="stylesheet" type="text/css" href="..ui/jquery-ui.css" />
+ <link rel="stylesheet" type="text/css" href="../ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="../ui/ipa.css" />
- <link rel="stylesheet" type="text/css" href="ipa_migration.css" />
</head>
<body class="info-page">
@@ -27,11 +26,9 @@
<div id="formwindow">
<h2>Login</h2>
<div id="error-box">
- <div class="formcontent">
<p><strong>Please re-enter your username or password</strong></p>
<p>The password or username you entered is incorrect. Please try again (make sure your caps lock is off).</p>
<p>If the problem persists, contact your administrator.</p>
- </div>
</div>
<form id="login" action="migration.py" method="post" name="">
<ul>
diff --git a/install/migration/ipa_migration.css b/install/migration/ipa_migration.css
deleted file mode 100644
index 68d070f95..000000000
--- a/install/migration/ipa_migration.css
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Authors:
- * Pavel Zuna <pzuna@redhat.com>
- * Adam Young <ayoung@redhat.com>
- * Endi Sukma Dewata <edewata@redhat.com>
- * Kyle Baker <kybaker@redhat.com>
- *
- * Copyright (C) 2010 Red Hat
-*/
-
-/* Migration */
-
-h1 {
- color: #333333;
- font-family: "Overpass Bold", "Liberation Sans", Arial, sans-serif;
- font-size: 1.5em;
- font-weight: normal;
- text-transform: uppercase;
-}
-
-#formwindow {
- -moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
- -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
- background: none repeat scroll 0 0 #FFFFFF;
- border-color: #FFFFFF #F0F0F0 #F0F0F0;
- border-right: 1px solid #F0F0F0;
- border-style: solid;
- border-width: 1px;
- color: #3F3F3F;
- margin: 40px auto 100px;
- width: 450px;
-}
-
-.formcontent {
- padding: 0 1em 2em 2em;
-}
-
-#error-box {
- -moz-border-radius: 0.3em 0.3em 0.3em 0.3em;
- -webkit-border-radius: 0.3em 0.3em 0.3em 0.3em;
- background-color: #FFEBE8;
- border: 1px solid #DD3C10;
- margin: 0 2em 1em;
- padding: 1em 1em 0 0;
-}
-
-#formwindow h2 {
- background-color: #F0F0F0;
- font-size: 1.6em;
- padding: 18px 15px 14px 22px;
- text-transform: uppercase;
- margin: 0 0 1em 0;
- font-weight: bold;
-}
-
-#login li {
- padding-bottom: 15px;
- text-align: right;
- width: 370px;
- list-style-type: none;
-}
-
-#login li input {
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
- margin-left: 15px;
- padding: 2px 10px;
- width: 248px;
-}
-
-#login li label, #modal li label {
- font-weight: bold;
- font-size: 1.2em;
- list-style-type: none;
-}
-
-form#login {
- display: inline-block;
- padding-bottom: 15px;
- width: 418px;
-}
-
-.formbutton input {
- float: right;
- margin: 1em 1em 1em 0;
- -moz-border-radius: 0.3em 0.3em 0.3em 0.3em;
- -webkit-border-radius: 0.3em 0.3em 0.3em 0.3em;
- border-radius: 0.3em 0.3em 0.3em 0.3em;
- background: -moz-linear-gradient(center top, #959595, #5e5e5e) repeat scroll 0 0 transparent;
- background: -webkit-radial-gradient(center top, #959595, #5e5e5e) repeat scroll 0 0 transparent;
- border: 1px solid #777777;
- color: #ffffff;
- font-weight: normal;
- padding: 0.5em 0.8em;
-} \ No newline at end of file
diff --git a/install/ui/Makefile.am b/install/ui/Makefile.am
index a4d083ac0..6e019ecd9 100644
--- a/install/ui/Makefile.am
+++ b/install/ui/Makefile.am
@@ -38,6 +38,8 @@ app_DATA = \
jquery.js \
jquery.ordered-map.js \
json2.js \
+ login.html \
+ login.js \
logout.html \
navigation.js \
net.js \
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index e6e6e1cd2..28c71ad54 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -31,6 +31,7 @@ IPA.dialog_button = function(spec) {
that.name = spec.name;
that.label = spec.label || spec.name;
that.click = spec.click || click;
+ that.visible = spec.visible !== undefined ? spec.visible : true;
function click() {
}
@@ -152,13 +153,6 @@ IPA.dialog = function(spec) {
that.create();
that.reset();
- // create a map of button labels and handlers
- var dialog_buttons = {};
- for (var i=0; i<that.buttons.values.length; i++) {
- var button = that.buttons.values[i];
- dialog_buttons[button.label] = button.click;
- }
-
that.container.dialog({
title: that.title,
modal: true,
@@ -166,12 +160,31 @@ IPA.dialog = function(spec) {
minWidth: that.width,
height: that.height,
minHeight: that.height,
- buttons: dialog_buttons,
close: function(event, ui) {
that.close();
}
});
+ that.set_buttons();
+ };
+
+ that.option = function(name, value) {
+ that.container.dialog('option', name, value);
+ };
+
+ that.set_buttons = function() {
+
+ // create a map of button labels and handlers
+ var dialog_buttons = {};
+ for (var i=0; i<that.buttons.values.length; i++) {
+ var button = that.buttons.values[i];
+ if (!button.visible) continue;
+ dialog_buttons[button.label] = button.click;
+ }
+
+ //set buttons to dialog
+ that.option('buttons', dialog_buttons);
+
// find button elements
var parent = that.container.parent();
var buttons = $('.ui-dialog-buttonpane .ui-dialog-buttonset button', parent);
@@ -182,8 +195,14 @@ IPA.dialog = function(spec) {
});
};
- that.option = function(name, value) {
- that.container.dialog('option', name, value);
+ that.display_buttons = function(names) {
+
+ for (var i=0; i<that.buttons.values.length; i++) {
+ var button = that.buttons.values[i];
+
+ button.visible = names.indexOf(button.name) > -1;
+ }
+ that.set_buttons();
};
that.save = function(record) {
diff --git a/install/ui/field.js b/install/ui/field.js
index 5c10abb64..a6553b1a8 100644
--- a/install/ui/field.js
+++ b/install/ui/field.js
@@ -105,7 +105,9 @@ IPA.field = function(spec) {
var values = that.save();
if (IPA.is_empty(values) && that.is_required() && that.enabled) {
that.valid = false;
- that.show_error(IPA.messages.widget.validation.required);
+ var message = IPA.get_message('widget.validation.required',
+ "Required field");
+ that.show_error(message);
return false;
}
return true;
@@ -396,7 +398,7 @@ IPA.validator = function(spec) {
var that = {};
- that.message = spec.message || IPA.messages.widget.validation.error;
+ that.message = spec.message || IPA.get_message('widget.validation.error');
that.false_result = function(message) {
return {
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index 992e44d0a..e86f6135f 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -1524,4 +1524,101 @@ span.sshkey-status, a.sshkey-set {
.automember-header .default_group label {
margin-right: 20px;
-} \ No newline at end of file
+}
+
+/* --- Stand alone forms --- */
+
+#formwindow {
+ -moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
+ -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
+ background: none repeat scroll 0 0 #FFFFFF;
+ border-color: #FFFFFF #F0F0F0 #F0F0F0;
+ border-right: 1px solid #F0F0F0;
+ border-style: solid;
+ border-width: 1px;
+ color: #3F3F3F;
+ margin: 40px auto 100px;
+ width: 450px;
+}
+
+#error-box, .error-box {
+ -moz-border-radius: 0.3em 0.3em 0.3em 0.3em;
+ -webkit-border-radius: 0.3em 0.3em 0.3em 0.3em;
+ background-color: #FFEBE8;
+ border: 1px solid #DD3C10;
+ margin: 0 2em 1em 2em;
+ padding: 1em 2em;
+}
+
+#formwindow h2 {
+ background-color: #F0F0F0;
+ font-size: 1.6em;
+ padding: 18px 15px 14px 22px;
+ text-transform: uppercase;
+ margin: 0 0 1em 0;
+ font-weight: bold;
+}
+
+.formbutton input {
+ float: right;
+ margin: 1em 1em 1em 0;
+ -moz-border-radius: 0.3em 0.3em 0.3em 0.3em;
+ -webkit-border-radius: 0.3em 0.3em 0.3em 0.3em;
+ border-radius: 0.3em 0.3em 0.3em 0.3em;
+ background: -moz-linear-gradient(center top, #959595, #5e5e5e) repeat scroll 0 0 transparent;
+ background: -webkit-radial-gradient(center top, #959595, #5e5e5e) repeat scroll 0 0 transparent;
+ border: 1px solid #777777;
+ color: #ffffff;
+ font-weight: normal;
+ padding: 0.5em 0.8em;
+}
+
+.formcontent {
+ padding: 0em 1em 1em;
+}
+
+/* --- Login form --- */
+#login li {
+ padding-bottom: 15px;
+ text-align: right;
+ width: 370px;
+ list-style-type: none;
+}
+
+#login li input {
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
+ margin-left: 15px;
+ padding: 2px 10px;
+ width: 248px;
+}
+
+#login li label, #modal li label {
+ font-weight: bold;
+ font-size: 1.2em;
+ list-style-type: none;
+}
+
+form#login {
+ display: inline-block;
+ padding-bottom: 15px;
+ width: 418px;
+}
+
+/* --- Login page --- */
+
+.login-page #formwindow {
+ margin-top: 100px;
+}
+
+/* --- Unauthorized dialog --- */
+
+.auth-dialog {
+ padding: 0 2em;
+}
+
+.auth-dialog h3 {
+ margin: 0.5em;
+}
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index 0afa4f097..b5a7486d5 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -357,6 +357,37 @@ IPA.logout = function() {
$.ajax(request);
};
+IPA.login_password = function(username, password) {
+
+ var success = false;
+
+ function success_handler(data, text_status, xhr) {
+ success = true;
+ }
+
+ var data = {
+ user: username,
+ password: password
+ };
+
+ var request = {
+ url: '/ipa/session/login_password',
+ data: data,
+ contentType: 'application/x-www-form-urlencoded',
+ processData: true,
+ dataType: 'html',
+ async: false,
+ type: 'POST',
+ success: success_handler
+ };
+
+ IPA.display_activity_icon();
+ $.ajax(request);
+ IPA.hide_activity_icon();
+
+ return success;
+};
+
/**
* Call an IPA command over JSON-RPC.
*
@@ -450,6 +481,20 @@ IPA.command = function(spec) {
dialog.open();
}
+ function auth_dialog_open(xhr, text_status, error_thrown) {
+
+ var ajax = this;
+
+ var dialog = IPA.unauthorized_dialog({
+ xhr: xhr,
+ text_status: text_status,
+ error_thrown: error_thrown,
+ command: that
+ });
+
+ dialog.open();
+ }
+
/*
* Special error handler used the first time this command is
* submitted. It checks to see if the session credentials need
@@ -488,16 +533,8 @@ IPA.command = function(spec) {
IPA.hide_activity_icon();
if (xhr.status === 401) {
- error_thrown = {}; // error_thrown is string
- error_thrown.name = IPA.get_message('ajax.401.title',
- 'Kerberos ticket no longer valid.');
- error_thrown.message = IPA.get_message('ajax.401.message',
- "Your kerberos ticket is no longer valid. "+
- "Please run kinit and then click 'Retry'. "+
- "If this is your first time running the IPA Web UI "+
- "<a href='/ipa/config/unauthorized.html'>"+
- "follow these directions</a> to configure your browser.");
-
+ auth_dialog_open(xhr, text_status, error_thrown);
+ return;
} else if (!error_thrown) {
error_thrown = {
name: xhr.responseText || IPA.get_message('errors.unknown_error', 'Unknown Error'),
@@ -1139,40 +1176,39 @@ IPA.error_dialog = function(spec) {
* ticket, the messages including the button labels have not
* been loaded yet, so the button labels need default values.
*/
- var label;
-
- if(that.visible_buttons.indexOf('retry') > -1) {
- label = IPA.get_message('buttons.retry', 'Retry');
- that.create_button({
- name: 'retry',
- label: label,
- click: function() {
- that.on_retry();
- }
- });
- }
- if(that.visible_buttons.indexOf('ok') > -1) {
- label = IPA.get_message('buttons.ok', 'OK');
- that.create_button({
- name: 'ok',
- label: label,
- click: function() {
- that.on_ok();
- }
- });
- }
+ var visible = that.visible_buttons.indexOf('retry') > -1;
+ var label = IPA.get_message('buttons.retry', 'Retry');
+ that.create_button({
+ name: 'retry',
+ label: label,
+ visible: visible,
+ click: function() {
+ that.on_retry();
+ }
+ });
- if(that.visible_buttons.indexOf('cancel') > -1) {
- label = IPA.get_message('buttons.cancel', 'Cancel');
- that.create_button({
- name: 'cancel',
- label: label,
- click: function() {
- that.on_cancel();
- }
- });
- }
+ visible = that.visible_buttons.indexOf('ok') > -1;
+ label = IPA.get_message('buttons.ok', 'OK');
+ that.create_button({
+ name: 'ok',
+ label: label,
+ visible: visible,
+ click: function() {
+ that.on_ok();
+ }
+ });
+
+ visible = that.visible_buttons.indexOf('cancel') > -1;
+ label = IPA.get_message('buttons.cancel', 'Cancel');
+ that.create_button({
+ name: 'cancel',
+ label: label,
+ visible: visible,
+ click: function() {
+ that.on_cancel();
+ }
+ });
};
that.on_retry = function() {
@@ -1262,6 +1298,175 @@ IPA.create_4304_error_handler = function(adder_dialog) {
};
};
+IPA.unauthorized_dialog = function(spec) {
+
+ spec = spec || {};
+
+ spec.sections = [
+ {
+ fields: [
+ {
+ name: 'username',
+ required: true,
+ label: IPA.get_message('login.username', "Username")
+ },
+ {
+ name: 'password',
+ type: 'password',
+ required: true,
+ label: IPA.get_message('login.password', "Password")
+ }
+ ]
+ }
+ ];
+
+ spec.visible_buttons = spec.visible_buttons || ['retry'];
+
+ var that = IPA.error_dialog(spec);
+
+ that.title = spec.title || IPA.get_message('ajax.401.title',
+ 'Kerberos ticket no longer valid.');
+
+ that.message = spec.message || IPA.get_message('ajax.401.message',
+ "Your kerberos ticket is no longer valid. "+
+ "Please run kinit and then click 'Retry'. "+
+ "If this is your first time running the IPA Web UI "+
+ "<a href='/ipa/config/unauthorized.html'>"+
+ "follow these directions</a> to configure your browser.");
+
+ that.form_auth_failed = "<p><strong>Please re-enter your username or password</strong></p>" +
+ "<p>The password or username you entered is incorrect. " +
+ "Please try again (make sure your caps lock is off).</p>" +
+ "<p>If the problem persists, contact your administrator.</p>";
+
+ that.create = function() {
+
+ that.krb_message_contatiner = $('<div\>').appendTo(that.container);
+
+ $('<p/>', {
+ html: that.message
+ }).appendTo(that.krb_message_contatiner);
+
+ var text = IPA.get_message('login.use', "Or you can use ");
+ var fb_title = $('<p/>', {
+ text: text
+ }).appendTo(that.krb_message_contatiner);
+
+ text = IPA.get_message('login.form_auth', "form-based authentication");
+ $('<a/>', {
+ text: text,
+ style: 'cursor:pointer;',
+ click: that.show_form
+ }).appendTo(fb_title);
+
+ fb_title.append('.');
+
+ that.create_form();
+ };
+
+ that.create_form = function() {
+
+ that.form = $('<div>', {
+ 'class': 'auth-dialog',
+ style: 'display: none;'
+ }).appendTo(that.container);
+
+ var text = IPA.get_message('login.login', "Login");
+ $('<h3/>', {
+ text: text
+ }).appendTo(that.form);
+
+ that.error_box = $('<div/>', {
+ 'class': 'error-box',
+ style: 'display:none',
+ html: that.form_auth_failed
+ }).appendTo(that.form);
+
+
+ var widgets = that.widgets.get_widgets();
+ for (var i=0; i<widgets.length; i++) {
+ var widget = widgets[i];
+
+ var div = $('<div/>', {
+ name: widget.name,
+ 'class': 'dialog-section'
+ }).appendTo(that.form);
+
+ widget.create(div);
+ }
+ };
+
+ that.create_login_buttons = function() {
+
+ var visible = that.visible_buttons.indexOf('login') > -1;
+ var label = IPA.get_message('login.login', "Login");
+ that.create_button({
+ name: 'login',
+ label: label,
+ visible: visible,
+ click: function() {
+ that.on_login();
+ }
+ });
+
+ visible = that.visible_buttons.indexOf('back') > -1;
+ label = IPA.get_message('buttons.back', "Back");
+ that.create_button({
+ name: 'back',
+ label: label,
+ visible: visible,
+ click: function() {
+ that.on_back();
+ }
+ });
+ };
+
+ that.show_form = function() {
+
+ that.krb_message_contatiner.css('display', 'none');
+ that.form.css('display', 'block');
+
+ that.display_buttons(['login', 'back']);
+ };
+
+ that.on_back = function() {
+
+ that.krb_message_contatiner.css('display', 'block');
+ that.form.css('display', 'none');
+
+ that.display_buttons(['retry']);
+ };
+
+ that.on_login = function() {
+
+ if (!that.validate()) return;
+
+ var record = {};
+ that.save(record);
+
+ IPA.display_activity_icon();
+
+ var success = IPA.login_password(record.username[0], record.password[0]);
+
+ IPA.hide_activity_icon();
+
+ if (success) {
+ that.on_login_success();
+ } else {
+ that.error_box.css('display', 'block');
+ }
+ };
+
+ that.on_login_success = function() {
+ that.error_box.css('display', 'none');
+ that.on_retry();
+ };
+
+ that.create_login_buttons();
+
+ return that;
+};
+
IPA.limit_text = function(value, max_length) {
if (!value) return '';
diff --git a/install/ui/jsl.conf b/install/ui/jsl.conf
index 508897af1..e03212d45 100644
--- a/install/ui/jsl.conf
+++ b/install/ui/jsl.conf
@@ -157,3 +157,4 @@
+process automount.js
+process automember.js
+process webui.js
++process login.js
diff --git a/install/ui/login.html b/install/ui/login.html
new file mode 100644
index 000000000..d88ee0eeb
--- /dev/null
+++ b/install/ui/login.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>IPA: Identity Policy Audit</title>
+
+ <link rel="stylesheet" type="text/css" href="ipa.css" />
+
+ <script type="text/javascript" src="json2.js"></script>
+ <script type="text/javascript" src="jquery.js"></script>
+ <script type="text/javascript" src="login.js"></script>
+</head>
+
+<body class="info-page login-page">
+
+ <div class="container_1">
+
+ <div class="header-logo">
+ <img src="images/ipa-logo.png" /><img src="images/ipa-banner.png" />
+ </div>
+
+ <div id="formwindow">
+ <h2>Login</h2>
+ <div id="error-box" style="display:none">
+ <p><strong>Please re-enter your username or password</strong></p>
+ <p>The password or username you entered is incorrect. Please try again (make sure your caps lock is off).</p>
+ <p>If the problem persists, contact your administrator.</p>
+ </div>
+
+ <form id="login">
+ <ul>
+ <li>
+ <label for="username">Username:</label>
+ <input type="text" name="username" value="" accesskey="u" />
+ </li>
+ <li>
+ <label for="password">Password:</label>
+ <input type="password" name="password" value="" accesskey="p" />
+ </li>
+ <ul>
+
+ <div class="formbutton">
+ <input name="submit" value="Login" type="submit" />
+ </div>
+ </form>
+ </div>
+ </div>
+
+</body>
+
+</html>
diff --git a/install/ui/login.js b/install/ui/login.js
new file mode 100644
index 000000000..68b16bce1
--- /dev/null
+++ b/install/ui/login.js
@@ -0,0 +1,76 @@
+/* Authors:
+ * Petr Vobornik <pvoborni@redhat.com>
+ *
+ * Copyright (C) 2010 Red Hat
+ * see file 'COPYING' for use and warranty information
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+var LP = {}; //Login Page
+
+LP.login = function(username, password) {
+
+ var success = false;
+
+ function success_handler(data, text_status, xhr) {
+ success = true;
+ }
+
+ var data = {
+ user: username,
+ password: password
+ };
+
+ var request = {
+ url: '/ipa/session/login_password',
+ data: data,
+ async: false,
+ type: "POST",
+ success: success_handler
+ };
+
+ $.ajax(request);
+
+ return success;
+};
+
+LP.on_submit = function() {
+
+ var username = $('input[name=username]', LP.form).val();
+ var password = $('input[name=password]', LP.form).val();
+
+ var success = LP.login(username, password);
+
+ if (!success) {
+ $('#error-box').css('display', 'block');
+ } else {
+ window.location = '/ipa/ui';
+ }
+};
+
+LP.init = function() {
+
+ LP.form = $('#login');
+
+ $('input[name=submit]', LP.form).click(function() {
+ LP.on_submit();
+ return false;
+ });
+};
+
+/* main (document onready event handler) */
+$(function() {
+ LP.init();
+}); \ No newline at end of file
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index e5b4be169..0182aab73 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -46,6 +46,7 @@
"add_and_close": "Add and Close",
"add_and_edit": "Add and Edit",
"add_many": "Add Many",
+ "back": "Back",
"cancel": "Cancel",
"close": "Close",
"edit": "Edit",
@@ -110,9 +111,14 @@
},
"false": "False",
"login": {
+ "form_auth": "form-based authentication",
"header": "Logged In As",
+ "login": "Login",
"logout": "Logout",
- "logout_error": "Logout error"
+ "logout_error": "Logout error",
+ "password": "Password",
+ "use": "Or you can use ",
+ "username": "Username"
},
"objects": {
"aci": {
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 642d3250d..d288a9bf4 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -85,7 +85,6 @@ IPA.input_widget = function(spec) {
$('<span/>', {
name: 'error_link',
- html: IPA.messages.widget.validation.error,
'class': 'ui-state-error ui-corner-all',
style: 'display:none'
}).appendTo(container);
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 4ccbe5cd6..deff866ee 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -181,6 +181,7 @@ class i18n_messages(Command):
"add_and_close": _("Add and Close"),
"add_and_edit": _("Add and Edit"),
"add_many": _("Add Many"),
+ "back": _("Back"),
"cancel": _("Cancel"),
"close": _("Close"),
"edit": _("Edit"),
@@ -245,9 +246,14 @@ class i18n_messages(Command):
},
"false": _("False"),
"login": {
+ "form_auth": _("form-based authentication"),
"header": _("Logged In As"),
+ "login": _("Login"),
"logout": _("Logout"),
"logout_error": _("Logout error"),
+ "password": _("Password"),
+ "use": _("Or you can use "),
+ "username": _("Username"),
},
"objects": {
"aci": {