Location: PHPKode > projects > Blackwolf CMF > projectBlackWolf/lib/User/Auth.class.php
<?php
/* Please see the README and LICENSE files. */

/**
 * Description of Auth
 */
class User_Auth {
    /**
     * Attempt to login
     * 
     * @param String $username
     * @param String $password
     * @return Mixed The session object if valid, false otherwise
     */
    public static function login($username,$password){
        if(!self::validate($username, $password)){ return false;}
        return self::new_session();
    }
    
    /**
     * Check validity of credentials
     * 
     * @param String $username
     * @param String $password
     * @return Boolean True if valid
     */
    public static function validate($username,$password){
        // TODO
        // Use data objects to access a storage mechanism
        if(!($username == "admin") || !($password == "P@$$")){
            return false;
        }
        return true;
    }
    
    /**
     * Build the session
     * 
     * @return User_Session 
     */
    protected static function new_session(){
        // TODO
        // Build from storage
        return new User_Session(27,"User");
    }
}

?>
Return current item: Blackwolf CMF