Adapt password expiration notification to new navigation

https://fedorahosted.org/freeipa/ticket/3902
This commit is contained in:
Petr Vobornik
2013-10-16 19:55:42 +02:00
committed by Martin Kosek
parent a0d3d5a295
commit 77a56b7f87
5 changed files with 16 additions and 18 deletions

View File

@@ -123,13 +123,10 @@ textarea[readonly] {
/* ---- Password expiration */
.header-passwordexpires {
margin-right: 30px;
color: red;
font-weight: bold;
}
.header-passwordexpires a {
font-weight: bold;
padding: 7px 10px;
line-height: 1;
}
/* ---- Notification area ---- */

View File

@@ -66,6 +66,7 @@ define([
on(this.app_widget.menu_widget, 'item-select', lang.hitch(this, this.on_menu_click));
on(this.app_widget, 'profile-click', lang.hitch(this, this.on_profile));
on(this.app_widget, 'logout-click', lang.hitch(this, this.on_logout));
on(this.app_widget, 'password-reset-click', lang.hitch(this, this.on_password_reset));
on(this.menu, 'selected', lang.hitch(this, this.on_menu_select));
on(this.router, 'facet-show', lang.hitch(this, this.on_facet_show));
@@ -179,6 +180,10 @@ define([
this.run_time.resolve();
},
on_password_reset: function() {
IPA.password_selfservice();
},
on_phase_error: function(error) {
window.console.error(error);

View File

@@ -589,16 +589,7 @@ IPA.update_password_expiration = function() {
if (diff <= notify_days) {
message = text.get('@i18n:password.expires_in');
message = message.replace('${days}', diff);
container.append(message + ' ');
$('<a/>', {
href: '#reset-password',
click: function() {
IPA.password_selfservice();
return false;
},
text: text.get('@i18n:password.reset_password_sentence'),
title: text.get('@i18n:password.reset_password')
}).appendTo(container);
container.append(message);
}
}
};

View File

@@ -191,6 +191,8 @@ define(['dojo/_base/declare',
this.emit('profile-click');
} else if (item.name === 'logout') {
this.emit('logout-click');
} else if (item.name == 'password_reset') {
this.emit('password-reset-click');
}
},
@@ -205,6 +207,10 @@ define(['dojo/_base/declare',
name: 'profile',
label: 'Profile'
},
{
name: 'password_reset',
label: 'Change password'
},
{
'class': 'divider'
},

View File

@@ -198,12 +198,11 @@ class test_user(UI_driver):
header = self.find('.header', By.CSS_SELECTOR)
self.assert_text(
'.header-passwordexpires',
'Your password expires in 6 days. Reset your password.',
'Your password expires in 6 days.',
header)
# test password reset
link = self.find('.header-passwordexpires a', By.CSS_SELECTOR, strict=True)
link.click()
self.profile_menu_action('password_reset')
self.fill_password_dialog(pwd, pwd)
# cleanup