Logo Search packages:      
Sourcecode: bamboo version File versions

StaticUserStore.php

<?php

/*

StaticUserStore

A very simple user storage backend which allows a single user
to be hardcoded in the b.site file:

   userbackend = static, myuser:mypassword

*/

$base = dirname(dirname(__FILE__));
require_once("$base/UserStore.php");

class StaticUserStore extends UserStore {

var $user;
var $pass;

function StaticUserStore($args) {
      list($this->user,$this->pass) = explode(":",$args);
}

function authenticate($user,$pass,&$error) {
      $seed = preg_replace('/^\$.\$(.*)\$.*$/','$1',$this->pass);
      $hash_pass = crypt($pass,'$1$'.$seed);

      if ($user == $this->user && $pass == $this->pass) {
            return true;
      }
      elseif ($user == $this->user && $hash_pass == $this->pass) {
            return true;
      }
      else {
            $error = _("User or password is incorrect");
            return false;
      }
}

} // end class

return;
?>

Generated by  Doxygen 1.6.0   Back to index