Commit b554bda9 authored by Leigh Stoller's avatar Leigh Stoller

Forgot about guest users in previous commit for duration.

parent 34179821
......@@ -253,7 +253,7 @@ fatal($@)
#
# Make sure all the required arguments were provided.
#
foreach my $key ("username", "email", "profile", "portal", "duration") {
foreach my $key ("username", "email", "profile", "portal") {
fatal("Missing required attribute '$key'")
if (! (exists($xmlparse->{'attribute'}->{"$key"}) &&
defined($xmlparse->{'attribute'}->{"$key"}) &&
......@@ -271,13 +271,20 @@ my ($value, $user_urn, $user_uid, $user_hrn, $user_email, $project, $pid,
$portal = $xmlparse->{'attribute'}->{"portal"}->{'value'};
# User specified duration.
$duration = $xmlparse->{'attribute'}->{"duration"}->{'value'};
if ($duration !~ /^\d+$/) {
fatal("Duration is not an integer");
if (exists($xmlparse->{'attribute'}->{"duration"}) &&
defined($xmlparse->{'attribute'}->{"duration"}) &&
$xmlparse->{'attribute'}->{"duration"}->{'value'} ne "") {
$duration = $xmlparse->{'attribute'}->{"duration"}->{'value'};
if ($duration !~ /^\d+$/) {
fatal("Duration is not an integer");
}
if ($duration < 1 || $duration > $maxduration) {
UserError("Duration must be at least 1 hour but ".
"not more then $maxduration hour(s)");
}
}
if ($duration < 1 || $duration > $maxduration) {
UserError("Duration must be at least 1 hour but ".
"not more then $maxduration hour(s)");
else {
$duration = $maxduration;
}
#
......
......@@ -907,7 +907,9 @@ function Do_Submit()
$args["auth_token"] = $_SESSION["auth_token"];
}
}
$args["duration"] = $formfields["duration"];
if ($this_user) {
$args["duration"] = $formfields["duration"];
}
if (0) {
TBERROR(print_r($args, true), 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment