Archived
1
0

Fix token generation

This commit is contained in:
Mercier Pierre-Olivier 2013-09-14 18:54:01 +02:00
parent feb69dd6f0
commit 905cc5f2e2
2 changed files with 10 additions and 5 deletions

View File

@ -34,6 +34,8 @@ sub log($@)
{
my $level = shift;
if ($#_ < 0) { return; }
if (!$log_fd && $log_file) {
open ($log_fd, ">>", $log_file) or die("Unable to open log ($log_file) file for writing");
say $log_fd strftime("%a %b %e %H:%M:%S %Y", localtime), " START new logging session ";

View File

@ -152,7 +152,7 @@ sub tag_project
do {
$token = sha1_base64(rand);
$token =~ s/[^a-zA-Z0-9]//g;
} while (length $token >= 12);
} while (length $token < 12);
$vcs->setAttribute("token", $token);
$mod = 1;
}
@ -178,11 +178,12 @@ sub tag_project
};
if ($@)
{
if ($@ =~ /apP]roject [aA]ll?ready [eE]xists/) {
log WARN, $@;
my $err = $@;
if ($err =~ /[pP]roject [aA]ll?ready [eE]xists/) {
log WARN, $err;
}
else {
log ERROR, $@;
log ERROR, $err;
}
}
@ -190,7 +191,9 @@ sub tag_project
eval {
API::Projects::gen_groups($project_id, $year);
};
log ERROR, $_ if($@);
if($@) {
log ERROR, $_;
}
}
else
{