From 38141865926730506f55b62a499cb548b94d4bfe Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 23 Oct 2009 22:25:36 -0600 Subject: Created user.css. Moved user-related form css to the new sheet. --- modules/user/css/user.css | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 modules/user/css/user.css (limited to 'modules/user/css') diff --git a/modules/user/css/user.css b/modules/user/css/user.css new file mode 100644 index 00000000..aa21f9c3 --- /dev/null +++ b/modules/user/css/user.css @@ -0,0 +1,7 @@ +#g-login-form, +#g-add-user-form +#g-edit-user-form, +#g-delete-user-form, +#g-user-admin { + width: 270px; +} \ No newline at end of file -- cgit v1.2.3 From bb47b495a7d719ee679e4747e9fd5b8f7c39b58a Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 23 Oct 2009 22:28:26 -0600 Subject: Moved remaining user and group admin css into the new user.css style sheet. --- modules/user/css/user.css | 51 +++++++++++++++++++++++++++++++++++++++- themes/admin_wind/css/screen.css | 44 ---------------------------------- 2 files changed, 50 insertions(+), 45 deletions(-) (limited to 'modules/user/css') diff --git a/modules/user/css/user.css b/modules/user/css/user.css index aa21f9c3..3b5e7ac2 100644 --- a/modules/user/css/user.css +++ b/modules/user/css/user.css @@ -4,4 +4,53 @@ #g-delete-user-form, #g-user-admin { width: 270px; -} \ No newline at end of file +} + +#g-user-admin-list .admin { + color: #55f; + font-weight: bold; +} + +li.g-group { + float: left; + display: block; + width: 200px; + border: 1px solid gray; + padding: 0; + margin: 0 1em 1em 0; +} + +li.g-group h4 { + background-color: #eee; + border-bottom: 1px dashed #ccc; + padding: .5em 0 .5em .5em; +} + +li.g-group .g-button { + padding: 0; +} + +li.g-group ul, li.g-group div { + height: 180px; + margin: 1px; + overflow: auto; + padding-top: .2em; +} + +li.g-group div p { + color: gray; + text-align: center; + padding: 2em .5em 0 .5em +} + +li.g-group .g-user { + padding: .2em 0 0 .5em; +} + +li.g-group .g-user .g-button { + vertical-align: middle; +} + +li.g-default-group h4, li.g-default-group .g-user { + color: gray; +} diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index a889545b..25302407 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -373,55 +373,11 @@ tr.g-warning { margin-right: 1em; } -#g-user-admin-list .admin { - color: #55f; - font-weight: bold; -} - .g-actions a, .g-actions span { margin-right: 3em; } -li.g-group { - float: left; - display: block; - width: 200px; - border: 1px solid gray; - padding: 0; - margin: 0 1em 1em 0; -} - -li.g-group h4 { - background-color: #eee; - border-bottom: 1px dashed #ccc; - padding: .5em 0 .5em .5em; -} -li.g-group .g-button { - padding: 0; -} -li.g-group ul, li.g-group div { - height: 180px; - margin: 1px; - overflow: auto; - padding-top: .2em; -} -li.g-group div p { - color: gray; - text-align: center; - padding: 2em .5em 0 .5em -} -li.g-group .g-user { - padding: .2em 0 0 .5em; -} -li.g-group .g-user .g-button { - vertical-align: middle; -} - -li.g-default-group h4, li.g-default-group .g-user { - color: gray; -} - /* Block admin ~~~~~~~~~~~~~~~~~~~~~~~~~ */ .g-admin-blocks-list { -- cgit v1.2.3 From 1347a300509b2ab3083bb88193987c18b33187ad Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 27 Oct 2009 12:23:48 -0700 Subject: Add a password strength meter. --- modules/user/controllers/admin_users.php | 13 +++++++---- modules/user/controllers/password.php | 11 +++++---- modules/user/controllers/users.php | 4 +++- modules/user/css/progressImg1.png | Bin 0 -> 390 bytes modules/user/css/user.css | 36 ++++++++++++++++++++++++++++ modules/user/helpers/user_theme.php | 2 ++ modules/user/js/password_strength.js | 39 +++++++++++++++++++++++++++++++ modules/user/views/user_form.html.php | 7 ++++++ 8 files changed, 101 insertions(+), 11 deletions(-) create mode 100644 modules/user/css/progressImg1.png create mode 100644 modules/user/js/password_strength.js create mode 100644 modules/user/views/user_form.html.php (limited to 'modules/user/css') diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php index 55a525ba..ac5dc33c 100644 --- a/modules/user/controllers/admin_users.php +++ b/modules/user/controllers/admin_users.php @@ -63,7 +63,9 @@ class Admin_Users_Controller extends Admin_Controller { } public function add_user_form() { - print $this->_get_user_add_form_admin(); + $v = new View("user_form.html"); + $v->form = $this->_get_user_add_form_admin(); + print $v; } public function delete_user($id) { @@ -156,12 +158,13 @@ class Admin_Users_Controller extends Admin_Controller { kohana::show_404(); } - $form = $this->_get_user_edit_form_admin($user); + $v = new View("user_form.html"); + $v->form = $this->_get_user_edit_form_admin($user); // Don't allow the user to control their own admin bit, else you can lock yourself out if ($user->id == identity::active_user()->id) { - $form->edit_user->admin->disabled(1); + $v->form->edit_user->admin->disabled(1); } - print $form; + print $v; } public function add_user_to_group($user_id, $group_id) { @@ -330,7 +333,7 @@ class Admin_Users_Controller extends Admin_Controller { $form->add_rules_from(ORM::factory("user")); $minimum_length = module::get_var("user", "mininum_password_length", 5); - $form->edit_user->password + $form->add_user->password ->rules($minimum_length ? "length[$minimum_length, 40]" : "length[40]"); module::event("user_add_form_admin", $user, $form); diff --git a/modules/user/controllers/password.php b/modules/user/controllers/password.php index 888fb37d..5f36b554 100644 --- a/modules/user/controllers/password.php +++ b/modules/user/controllers/password.php @@ -32,7 +32,7 @@ class Password_Controller extends Controller { if (request::method() == "post") { $this->_change_password(); } else { - $user = user::lookup_user_by_field("hash", Input::instance()->get("key")); + $user = user::lookup_by_hash(Input::instance()->get("key")); if (!empty($user)) { print $this->_new_password_form($user->hash); } else { @@ -46,7 +46,7 @@ class Password_Controller extends Controller { $valid = $form->validate(); if ($valid) { - $user = identity::lookup_user_by_name($form->reset->inputs["name"]->value); + $user = user::lookup_by_name($form->reset->inputs["name"]->value); if (!$user->loaded || empty($user->email)) { $form->reset->inputs["name"]->add_error("no_email", 1); $valid = false; @@ -110,19 +110,20 @@ class Password_Controller extends Controller { "mistyped", t("The password and the confirm password must match")); $group->submit("")->value(t("Update")); - $template->content = $form; + $template->content = new View("user_form.html"); + $template->content->form = $form; return $template; } private function _change_password() { $view = $this->_new_password_form(); - if ($view->content->validate()) { + if ($view->content->form->validate()) { $user = user::lookup_by_hash(Input::instance()->post("hash")); if (empty($user)) { throw new Exception("@todo FORBIDDEN", 503); } - $user->password = $view->content->reset->password->value; + $user->password = $view->content->form->reset->password->value; $user->hash = null; $user->save(); message::success(t("Password reset successfully")); diff --git a/modules/user/controllers/users.php b/modules/user/controllers/users.php index 3507ec6d..7bcc74d7 100644 --- a/modules/user/controllers/users.php +++ b/modules/user/controllers/users.php @@ -63,7 +63,9 @@ class Users_Controller extends Controller { access::forbidden(); } - print $this->_get_edit_form($user); + $v = new View("user_form.html"); + $v->form = $this->_get_edit_form($user); + print $v; } private function _get_edit_form($user) { diff --git a/modules/user/css/progressImg1.png b/modules/user/css/progressImg1.png new file mode 100644 index 00000000..a9093647 Binary files /dev/null and b/modules/user/css/progressImg1.png differ diff --git a/modules/user/css/user.css b/modules/user/css/user.css index 3b5e7ac2..67d4f196 100644 --- a/modules/user/css/user.css +++ b/modules/user/css/user.css @@ -54,3 +54,39 @@ li.g-group .g-user .g-button { li.g-default-group h4, li.g-default-group .g-user { color: gray; } + +.g-password-strength0 { + background: url(progressImg1.png) no-repeat 0 0; + width: 138px; + height: 7px; +} +.g-password-strength10 { + background-position:0 -7px; +} +.g-password-strength20 { + background-position:0 -14px; +} +.g-password-strength30 { + background-position:0 -21px; +} +.g-password-strength40 { + background-position:0 -28px; +} +.g-password-strength50 { + background-position:0 -35px; +} +.g-password-strength60 { + background-position:0 -42px; +} +.g-password-strength70 { + background-position:0 -49px; +} +.g-password-strength80 { + background-position:0 -56px; +} +.g-password-strength90 { + background-position:0 -63px; +} +.g-password-strength100 { + background-position:0 -70px; +} diff --git a/modules/user/helpers/user_theme.php b/modules/user/helpers/user_theme.php index 191fd15a..31e2e8c0 100644 --- a/modules/user/helpers/user_theme.php +++ b/modules/user/helpers/user_theme.php @@ -20,9 +20,11 @@ class user_theme_Core { static function head($theme) { $theme->css("user.css"); + $theme->script("password_strength.js"); } static function admin_head($theme) { $theme->css("user.css"); + $theme->script("password_strength.js"); } } \ No newline at end of file diff --git a/modules/user/js/password_strength.js b/modules/user/js/password_strength.js new file mode 100644 index 00000000..2442b8de --- /dev/null +++ b/modules/user/js/password_strength.js @@ -0,0 +1,39 @@ +(function($) { + // Based on the Password Strength Indictor By Benjamin Sterling + // http://benjaminsterling.com/password-strength-indicator-and-generator/ + $.widget("ui.user_password_strength", { + _init: function() { + var self = this; + $(this.element).keyup(function() { + var strength = self.calculateStrength (this.value); + var index = Math.min(Math.floor( strength / 10 ), 10); + $("#g-password-gauge") + .removeAttr('class') + .addClass( "g-password-strength0" ) + .addClass( self.options.classes[ index ] ); + }).after("
"); + }, + + calculateStrength: function(value) { + // Factor in the length of the password + var strength = Math.min(5, value.length) * 10 - 20; + // Factor in the number of numbers + strength += Math.min(3, value.length - value.replace(/[0-9]/g,"").length) * 10; + // Factor in the number of non word characters + strength += Math.min(3, value.length - value.replace(/\W/g,"").length) * 15; + // Factor in the number of Upper case letters + strength += Math.min(3, value.length - value.replace(/[A-Z]/g,"").length) * 10; + + // Normalizxe between 0 and 100 + return Math.max(0, Math.min(100, strength)); + } + }); + $.extend($.ui.user_password_strength, { + defaults: { + classes : ['g-password-strength10', 'g-password-strength20', 'g-password-strength30', + 'g-password-strength40', 'g-password-strength50', 'g-password-strength60', + 'g-password-strength70',' g-password-strength80',' g-password-strength90', + 'g-password-strength100'] + } + }); + })(jQuery); diff --git a/modules/user/views/user_form.html.php b/modules/user/views/user_form.html.php new file mode 100644 index 00000000..039ae8a5 --- /dev/null +++ b/modules/user/views/user_form.html.php @@ -0,0 +1,7 @@ + + + -- cgit v1.2.3 From d29d339ea0088b2aa9cd11701289db03ec307ea3 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sat, 14 Nov 2009 13:23:23 -0700 Subject: Move the password strength image out of css and into an images folder. --- modules/user/css/progressImg1.png | Bin 390 -> 0 bytes modules/user/css/user.css | 5 ++--- modules/user/images/progressImg1.png | Bin 0 -> 390 bytes 3 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 modules/user/css/progressImg1.png create mode 100644 modules/user/images/progressImg1.png (limited to 'modules/user/css') diff --git a/modules/user/css/progressImg1.png b/modules/user/css/progressImg1.png deleted file mode 100644 index a9093647..00000000 Binary files a/modules/user/css/progressImg1.png and /dev/null differ diff --git a/modules/user/css/user.css b/modules/user/css/user.css index 67d4f196..92441ffd 100644 --- a/modules/user/css/user.css +++ b/modules/user/css/user.css @@ -12,9 +12,8 @@ } li.g-group { - float: left; display: block; - width: 200px; + width: 100%; border: 1px solid gray; padding: 0; margin: 0 1em 1em 0; @@ -56,7 +55,7 @@ li.g-default-group h4, li.g-default-group .g-user { } .g-password-strength0 { - background: url(progressImg1.png) no-repeat 0 0; + background: url(../images/progressImg1.png) no-repeat 0 0; width: 138px; height: 7px; } diff --git a/modules/user/images/progressImg1.png b/modules/user/images/progressImg1.png new file mode 100644 index 00000000..a9093647 Binary files /dev/null and b/modules/user/images/progressImg1.png differ -- cgit v1.2.3 From 766d49c4614dfcde84ec75e5296635c5fc9d7a67 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sat, 14 Nov 2009 14:03:11 -0700 Subject: Fix floated group rows when more than one row exists. Attach g- before all css ids and classes for consistency. Other minor layout adjustments. --- modules/user/css/user.css | 8 ++++++-- modules/user/views/admin_users.html.php | 20 ++++++++++---------- modules/user/views/admin_users_group.html.php | 6 +++--- 3 files changed, 19 insertions(+), 15 deletions(-) (limited to 'modules/user/css') diff --git a/modules/user/css/user.css b/modules/user/css/user.css index 92441ffd..77e0b44b 100644 --- a/modules/user/css/user.css +++ b/modules/user/css/user.css @@ -13,10 +13,10 @@ li.g-group { display: block; - width: 100%; border: 1px solid gray; - padding: 0; margin: 0 1em 1em 0; + padding: 0; + width: 200px; } li.g-group h4 { @@ -54,6 +54,10 @@ li.g-default-group h4, li.g-default-group .g-user { color: gray; } +.g-group.ui-droppable { + padding: 0 !important; +} + .g-password-strength0 { background: url(../images/progressImg1.png) no-repeat 0 0; width: 138px; diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php index 18ad9403..df44794a 100644 --- a/modules/user/views/admin_users.html.php +++ b/modules/user/views/admin_users.html.php @@ -2,15 +2,15 @@