Skip to content

Instantly share code, notes, and snippets.

@bantu

bantu/auth.php

Forked from pellaeon/auth.php
Created Nov 28, 2013
Embed
What would you like to do?
namespace OC\Core\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Auth extends Command {
protected function configure() {
$this
->setName('auth')
->setDescription('Check credentials in CLI')
->addArgument('username', InputArgument::REQUIRED, 'Username')
->addArgument('password', InputArgument::REQUIRED, 'Password')
;
}
protected function execute(InputInterface $input, OutputInterface $output) {
$uid = \OC_User::checkPassword($input->getArgument('username'), $input->getArgument('password'));
if ( $uid == false ) {
echo "auth_ok:-1\n";
} else {
echo "auth_ok:1\n";
echo "dir:".\OC_User::getHome($uid)."\n";
$quota = \OC_Util::getUserQuota($uid);
new \OC\Files\Filesystem;
if ( $quota != \OC\Files\SPACE_UNLIMITED ) {
echo "user_quota_size:".$quota."\n";
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.