On 10/30/2013 01:18 PM, Ana Krivokapic wrote:
The patch fixes the issue.
I have just one nitpick:
+# reset password if needed
+if (self.get_auth_dialog()):
^^ ^^ <- redundant parentheses
Fixed
--
Petr Vobornik
From 26c0d6caa1085bfc3b747bb051929b0b7a78c57c Mon Sep 17 00:00:00 2001
From: Petr Vobornik
Date: Tue, 29 Oct 2013 16:01:25 +0100
Subject: [PATCH] Fix password expiration notification
- was broken by navigation and application controller refactoring
https://fedorahosted.org/freeipa/ticket/4003
---
install/ui/src/freeipa/Application_controller.js | 6 +-
install/ui/src/freeipa/ipa.js| 4 +-
install/ui/src/freeipa/user.js | 1 -
ipatests/test_webui/test_user.py | 113 +--
ipatests/test_webui/ui_driver.py | 32 ++-
5 files changed, 137 insertions(+), 19 deletions(-)
diff --git a/install/ui/src/freeipa/Application_controller.js b/install/ui/src/freeipa/Application_controller.js
index 4bde1238c3410fd166f714e37727a8e9cfd978fe..13c270fca4949d090eba1a29bfe91b7c35d9bbc0 100644
--- a/install/ui/src/freeipa/Application_controller.js
+++ b/install/ui/src/freeipa/Application_controller.js
@@ -116,8 +116,10 @@ define([
start_runtime: function() {
this.run_time = new Deferred();
-// now we are ready for displaying a facet
-// cat match a facet if hash is set
+IPA.update_password_expiration();
+
+// now we are ready for displaying a facet,
+// it can match a facet if hash is set
this.router.startup();
// choose default facet if not defined by route
diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js
index b3017650de899205ffe97b9e9e8fcbde65e4c917..51b4e1d242f69b51326525537ed137a31f4f6e73 100644
--- a/install/ui/src/freeipa/ipa.js
+++ b/install/ui/src/freeipa/ipa.js
@@ -610,7 +610,7 @@ IPA.update_password_expiration = function() {
*/
IPA.password_selfservice = function() {
var reset_dialog = IPA.user_password_dialog({
-self_service: true,
+pkey: IPA.whoami.uid[0],
on_success: function() {
var command = IPA.get_whoami_command();
var orig_on_success = command.on_success;
@@ -620,7 +620,7 @@ IPA.password_selfservice = function() {
};
command.execute();
-alert(text.get('@i18n:password.password_change_complete'));
+IPA.notify_success(text.get('@i18n:password.password_change_complete'));
reset_dialog.close();
}
});
diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js
index 34c3a7adf1e1304f66f9298c6a7cf21ecaff4d94..61bdb43b4ee7d23a5d118c4f29ff81e3b9f56fa1 100644
--- a/install/ui/src/freeipa/user.js
+++ b/install/ui/src/freeipa/user.js
@@ -536,7 +536,6 @@ IPA.user_password_dialog = function(spec) {
that.success_handler = spec.on_success;
that.error_handler = spec.on_error;
-that.self_service = spec.self_service; //option to force self-service
that.pkey = spec.pkey;
that.is_self_service = function() {
diff --git a/ipatests/test_webui/test_user.py b/ipatests/test_webui/test_user.py
index a17ac27a635cb0f1b0c7e8a60427a93294d351fc..eb5134188076228fc154a8c73b316b2ac06448d6 100644
--- a/ipatests/test_webui/test_user.py
+++ b/ipatests/test_webui/test_user.py
@@ -29,6 +29,11 @@ import ipatests.test_webui.data_hbac as hbac
import ipatests.test_webui.test_rbac as rbac
import ipatests.test_webui.data_sudo as sudo
+try:
+from selenium.webdriver.common.by import By
+except ImportError:
+pass
+
class test_user(UI_driver):
@@ -143,17 +148,107 @@ class test_user(UI_driver):
# reset password
pwd = self.config.get('ipa_password')
-fields = [
-('password', 'password1', pwd),
-('password', 'password2', pwd),
-]
+self.reset_password_action(pwd)
+self.assert_text_field('has_password', '**')
+
+# delete
+self.delete_action(user.ENTITY, user.PKEY)
+
+def test_password_expiration_notification(self):
+"""
+Test password expiration notification
+"""
+
+pwd = self.config.get('ipa_password')
+
+self.init_app()
+
+self.set_ipapwdexpadvnotify('15')
+
+# create user and group and add user to that group
+self.add_record(user.ENTITY, user.DATA)
+self.add_record(group.ENTITY, group.DATA)
+self.navigate_to_entity(group.ENTITY)
+self.navigate_to_record(group.PKEY)
+self.add_associations([user.PKEY])
+
+# password policy for group
+self.add_record('pwpolicy', {
+'pkey': group.PKEY,
+'add': [
+('combobox', 'cn', group.PKEY),
+('textbox', 'cospriority', '12345'),
+]})
+sel