Fixed multiple team->update in import_users

Show the pass at the end of import
This commit is contained in:
Li Chen 2013-12-01 01:08:40 +01:00
parent c067f6dbbe
commit 745d8a8bd5
2 changed files with 10 additions and 6 deletions

View File

@ -181,8 +181,7 @@ case $1 in
echo -e "Exported pkcs12 file is ${2}.p12" echo -e "Exported pkcs12 file is ${2}.p12"
fi fi
mv ${2}.crt ${TOP_DIR}/certs mv ${2}.crt ${TOP_DIR}/certs
# TODO handle this file echo "$2:$pass" >> ${TOP_DIR}/../teams.pass
echo "$2:$pass" >> teams.pass
clean "client" $2 clean "client" $2
;; ;;
"-revoke" ) "-revoke" )

View File

@ -48,15 +48,15 @@ if (!empty($_FILES["inputFile"]['tmp_name']))
else if ($child->nodeName == "member") else if ($child->nodeName == "member")
{ {
if (!$team->update()) // Slogan rly needed ?
if (empty($team->id) && !$team->update())
{ {
$error .= "Unable to add team $team->team_name</br>"; $error .= "Unable to add team $team->team_name</br>";
continue; continue;
} }
$user = new Member(); $user = new Member();
$user->team = $team; $user->team = $team;
foreach ($child->childNodes as $child_member) foreach ($child->childNodes as $child_member)
{ {
if ($child_member->nodeName == "firstname") if ($child_member->nodeName == "firstname")
@ -87,6 +87,11 @@ if (!empty($_FILES["inputFile"]['tmp_name']))
$output .= new_client($team->team_name, $misc_dir); $output .= new_client($team->team_name, $misc_dir);
} }
} }
if (file_exists("$misc_dir/teams.pass"))
{
$output .= file_get_contents("$misc_dir/teams.pass");
unlink("$misc_dir/teams.pass");
}
$template->assign("output", $output); $template->assign("output", $output);
} }