1
0
Fork 0

Warn users if github tokens contain invalid chars

pull/1410/head
Jordi Boggiano 2012-12-08 21:45:43 +01:00
parent 23d45f67c1
commit 0b94fd209a
1 changed files with 3 additions and 0 deletions

View File

@ -199,6 +199,9 @@ class Factory
// reload oauth token from config if available // reload oauth token from config if available
if ($tokens = $config->get('github-oauth')) { if ($tokens = $config->get('github-oauth')) {
foreach ($tokens as $domain => $token) { foreach ($tokens as $domain => $token) {
if (!preg_match('{^[a-z0-9]+$}', $token)) {
throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
}
$io->setAuthentication($domain, $token, 'x-oauth-basic'); $io->setAuthentication($domain, $token, 'x-oauth-basic');
} }
} }