[Jifty-commit] r4993 - in jifty/trunk: lib/Jifty/Plugin/Authentication/Password/Mixin/Model
Jifty commits
jifty-commit at lists.jifty.org
Tue Feb 5 09:43:52 EST 2008
Author: clkao
Date: Tue Feb 5 09:43:51 2008
New Revision: 4993
Modified:
jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
jifty/trunk/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t
Log:
* In authenticate::password plugin, do the password check on
creation and prevent empty password.
* Add todo tests for validate_password to be run on set_password,
which isn't currently the case.
Modified: jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm Tue Feb 5 09:43:51 2008
@@ -60,7 +60,6 @@
label is _('Password'),
type is 'varchar(64)',
max_length is 64,
- lenght is 16,
hints is _('Your password should be at least six characters'),
render_as 'password',
filters are 'Jifty::DBI::Filter::SaltHash';
@@ -135,7 +134,7 @@
return 1 if $self->has_alternative_auth();
return ( 0, _('Passwords need to be at least six characters long') )
- if length($new_value) && length($new_value) < 6;
+ if length($new_value) < 6;
return 1;
}
Modified: jifty/trunk/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t (original)
+++ jifty/trunk/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t Tue Feb 5 09:43:51 2008
@@ -11,7 +11,7 @@
use lib 't/lib';
use Jifty::SubTest;
-use Jifty::Test tests => 17;
+use Jifty::Test tests => 24;
# Make sure we can load the model
use_ok('TestApp::Plugin::PasswordAuth::Model::User');
@@ -68,3 +68,29 @@
password => 'secret');
ok($id, "Created with grey");
+my ($res, $msg) = $r->set_password('foo');
+TODO: {
+local $TODO = 'huh?';
+ok(!$res, 'unable to set password shorter than 6');
+like($msg, qr/at least six/);
+ok($r->password_is('secret'), 'password not changed');
+};
+
+($id, $msg) = $r->create( name => 'jesse3',
+ email => 'jrv2 at orz',
+ color => 'gray',
+ password => '',
+ swallow_type => 'african' );
+
+ok(!$id, "Can't creaet without password");
+like($msg, qr/at least six/);
+
+($id, $msg) = $r->create( name => 'jesse3',
+ email => 'jrv2 at orz',
+ color => 'gray',
+ password => '',
+ swallow_type => 'african' );
+
+ok(!$id, "Can't create without password");
+like($msg, qr/at least six/);
+
More information about the Jifty-commit
mailing list