コード例 #1
0
ファイル: configCheck.php プロジェクト: mokal/DCN_TestLink
/**
 * checks if the default password for the admin accout is still set
 *
 * @return boolean returns true if the default password for the admin account is set, 
 *         false else
 * @author Andreas Morsing 
 **/
function checkForAdminDefaultPwd(&$db)
{
    $passwordHasDefaultValue = false;
    $user = new tlUser();
    $user->login = "******";
    if ($user->readFromDB($db, tlUser::USER_O_SEARCH_BYLOGIN) >= tl::OK && $user->comparePassword("admin") >= tl::OK) {
        $passwordHasDefaultValue = true;
    }
    return $passwordHasDefaultValue;
}
コード例 #2
0
 /**
  * Generate the API Key
  *
  * @param struct $args
  * @param string $args["user"]
  * @param string $args["pass"]
  * @return string
  * @access public
  */
 public function generateAPIKey($args)
 {
     $this->_setArgs($args);
     $login = $this->args[self::$userParamName];
     $pwd = $this->args['pass'];
     $user = new tlUser();
     $user->login = $login;
     $login_exists = $user->readFromDB($this->dbObj, tlUser::USER_O_SEARCH_BYLOGIN) >= tl::OK;
     $checkBD = $user->comparePassword($pwd) == tl::OK;
     $checkLDAP = ldap_authenticate($login, $pwd);
     if ($checkBD or $checkLDAP->status_ok) {
         $user_id = tlUser::doesUserExist($this->dbObj, $login);
         if (is_null($user_id)) {
             $this->errors[] = new IXR_Error(NO_USER_BY_THIS_LOGIN, 'This is a valid user, but is not on TestLink DB');
         } else {
             $op = new stdClass();
             $op->status = tl::OK;
             $op->user_feedback = null;
             $APIKey = new APIKey();
             $ak = $APIKey->getAPIKey($user_id);
             if (!is_null($ak)) {
                 return $ak;
             }
             if ($APIKey->addKeyForUser($user_id) >= tl::OK) {
                 return $APIKey->getAPIKey($user_id);
             } else {
                 $this->errors[] = new IXR_Error(NO_DEV_KEY, NO_DEV_KEY_STR);
             }
         }
     } else {
         $this->errors[] = new IXR_Error(INVALID_AUTH, INVALID_AUTH_STR);
     }
     return $this->errors;
 }