User: sits    
  Date: 08/09/08 00:20:15

  Modified:    lib/Codestriker/Http Response.pm
               lib/Codestriker/Action Authenticate.pm
               bin      install.pl
  Log:
  Set the password hash into the cookie.  Next step will be to enforce
  login for certain methods.
  
  
  
  Index: Response.pm
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- Response.pm       6 Sep 2008 06:03:56 -0000       1.53
  +++ Response.pm       8 Sep 2008 07:20:14 -0000       1.54
  @@ -52,6 +52,7 @@
       my $projectid = "";
       my $load_anchor = "";
       my $topicsort = "";
  +    my $password_hash = "";
       my $fview = -1;
   
       my $reload = $params{reload};
  @@ -129,6 +130,13 @@
           $topicsort = $params{topicsort};
       }
   
  +    if (! defined $params{password_hash} || $params{password_hash} eq "") {
  +        $password_hash = Codestriker::Http::Cookie->get_property($query,
  +                                                                 
'password_hash');
  +    } else {
  +        $password_hash = $params{password_hash};
  +    }
  +
       $cookie{'email'} = $email if $email ne "";
       $cookie{'reviewers'} = $reviewers if $reviewers ne "";
       $cookie{'cc'} = $cc if $cc ne "";
  @@ -137,6 +145,7 @@
       $cookie{'repository'} = $repository if $repository ne "";
       $cookie{'projectid'} = $projectid if $projectid ne "";
       $cookie{'topicsort'} = $topicsort if $topicsort ne "";
  +    $cookie{'password_hash'} = $password_hash if $password_hash ne "";
   
       my $cookie_obj = Codestriker::Http::Cookie->make($query, \%cookie);
   
  
  
  
  
  
  Index: Authenticate.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Action/Authenticate.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Authenticate.pm   8 Sep 2008 06:49:38 -0000       1.1
  +++ Authenticate.pm   8 Sep 2008 07:20:14 -0000       1.2
  @@ -24,10 +24,11 @@
       my $feedback = "";
   
       # Check if the account for this email address is valid.
  +    my $user;
       if (!Codestriker::Model::User->exists($email)) {
           $feedback = "The username or password you entered is not valid.";
       } else {
  -        my $user = Codestriker::Model::User->new($email);
  +        $user = Codestriker::Model::User->new($email);
   
           # Check that the password entered is correct.
           if (! $user->check_password($password)) {
  @@ -42,11 +43,17 @@
           print $query->redirect(-URI => $url);
       } else {
           # Redirect to the specified URL, if present, otherwise go to the 
default
  -        # URL.
  +        # URL.  Get the current cookie, and set the password hash into it.
  +        my %cookie_hash = Codestriker::Http::Cookie->get($query);
  +        $cookie_hash{password_hash} = $user->{password_hash};
  +        my $cookie = Codestriker::Http::Cookie->make($query, \%cookie_hash);
  +
           if (defined $redirect && $redirect ne "") {
  -            print $query->redirect(-URI => $redirect);
  +            print $query->redirect(-cookie => $cookie,
  +                                   -URI => $redirect);
           } else {
  -            print $query->redirect(-URI => $query->url());
  +            print $query->redirect(-cookie => $cookie,
  +                                   -URI => $query->url());
           }
       }
   }
  
  
  
  
  
  Index: install.pl
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/bin/install.pl,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- install.pl        7 Sep 2008 04:49:27 -0000       1.25
  +++ install.pl        8 Sep 2008 07:20:15 -0000       1.26
  @@ -1080,7 +1080,7 @@
               Codestriker::Model::User->create($admin_user, 1);
               # TODO: consider sending email with password details.
               $user_added = 1;
  -            print "Done\n";
  +            print "Done.  You will need to use \"Reset Password\" on the 
login page.\n";
           } else {
               # Existing user, check if they are an admin already.
               my $user = Codestriker::Model::User->new($admin_user);
  
  
  

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits

Reply via email to