DataObjects/Person.php
authorChris <chris@roojs.com>
Mon, 18 Feb 2013 09:43:57 +0000 (17:43 +0800)
committerChris <chris@roojs.com>
Mon, 18 Feb 2013 09:43:57 +0000 (17:43 +0800)
DataObjects/Person.php

index e68ef8c..faf18b6 100644 (file)
@@ -384,6 +384,15 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
        
     }      
     
+    function generatePassword() // genearte a password (add set 'rawPasswd' to it's value)
+    {
+        require_once 'Text/Password.php';
+        $this->rawPasswd = strtr(ucfirst(Text_Password::create(5)).ucfirst(Text_Password::create(5)), array(
+        "a"=>"4", "e"=>"3",  "i"=>"1",  "o"=>"0", "s"=>"5",  "t"=>"7"));
+        $this->setPassword($this->rawPasswd);
+        return $this->rawPasswd;
+    }
+    
     function company()
     {
         $x = DB_DataObject::factory('Companies');