Changeset 5210

Show
Ignore:
Timestamp:
01/22/10 17:40:06 (2 months ago)
Author:
plim
Message:
 
Location:
plugins/VWPass/trunk/plugins/VWPass
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plugins/VWPass/trunk/plugins/VWPass/config.yaml

    r5183 r5210  
    1010init_app: $VWPass::VWPass::init_app 
    1111 
    12 callbacks: 
    13         api_pre_save.author: $VWPass::VWPass::pre_save_author 
    14         cms_pre_save.author: $VWPass::VWPass::pre_save_author 
    15  
    16  
    17  
  • plugins/VWPass/trunk/plugins/VWPass/lib/VWPass.pm

    r5208 r5210  
    2222         
    2323        # password must be at least 8 characters long 
    24         unless (scalar(split("",$p)) >= 8) {  
     24        unless (scalar(split("",$password)) >= 8) {  
    2525                push(@errors, "Password must be at least 8 characters long.");  
    2626        } 
     
    3232         
    3333        return $error_string; 
    34 } 
    35    
    36 sub pre_save_author { 
    37         my ($cb, $app, $author, $original) = @_; 
    38         my $password = $app->param('pass') || $app->param('password'); 
    39         my $error_string = password_is_strong($password); 
    40         $cb->error("$error_string") if ($error_string); 
    41         return 1; 
    4234} 
    4335 
     
    6254        *MT::CMS::User::save_filter = sub { 
    6355                my ($eh, $app) = @_; 
    64                 my $password = $app->param('pass') || $app->param('password'); 
    65                 if ($password) { 
    66                         my $error_string = password_is_strong($password); 
    67                         $app->error("$error_string") if ($error_string); 
     56                 
     57                if ( !$app->param('id') ) {    # it's a new object 
     58                        return $app->error("User requires password") if ( !$app->param('pass') ); 
     59                } else { 
     60                        my $password = $app->param('pass') || $app->param('password'); 
     61                        if ($password) { 
     62                                my $error_string = password_is_strong($password); 
     63                                $app->error("$error_string") if ($error_string); 
     64                        } 
    6865                } 
    6966                return $orig_method2->($eh, $app);