[Owncloud] Owncloud authentication with password policy

Pitichai Pitimaneeyakul pitichai at 2-cans.com
Tue May 15 16:21:09 UTC 2012


Hi there,
I am implementing some feature to check password policy such as password
age to expire, password warning before expire.
length of password and password complexity
I have a question on
+++ b/lib/user/backend.php
@@ -31,12 +31,13 @@ define('OC_USER_BACKEND_NOT_IMPLEMENTED',   -501);
 /**
  * actions that user backends can define
  */
 define('OC_USER_BACKEND_CREATE_USER',       0x000001);
 define('OC_USER_BACKEND_DELETE_USER',       0x000010);
 define('OC_USER_BACKEND_SET_PASSWORD',      0x000100);
 define('OC_USER_BACKEND_CHECK_PASSWORD',    0x001000);
+define('OC_USER_BACKEND_EXPIRE_PASSWORD',    0x001001);
 define('OC_USER_BACKEND_GET_USERS',         0x010000);
 define('OC_USER_BACKEND_USER_EXISTS',       0x100000);

I am wondering what these value impact to the code. I found function
"public function getSupportedActions()"and "public function
implementsActions($actions)" to work with these value.

can someone help to explain what these value will be impact in the program.

I have add something like this:
public function expirePassword( $uid ){
        $today =intval((time()/(60*60*24)));
        $query = OC_DB::prepare( "SELECT * FROM *PREFIX*users WHERE uid
= ?" );
        $result = $query->execute( array( $uid ));

        $row=$result->fetchRow();
        if($row){
            $mesg = $today."maxage=".$row['password_maxage']."
last=".$row['password_last'];

            if ($row['password_maxage'] == 0) {
                    return false;
            } else {
                $sum = $row['password_maxage'] + $row['password_last'];
                $mesg = "today = ".$today." sum = ".$sum;

                if  ($today >= $sum)  {
                    return true;
                } else {
                    return false;
                }
            }
        } else {
            return false;
        }
    }

and currently it is ok to check expired password

Thanks and Best Regards,
PP



More information about the Owncloud mailing list