Skip to content
Snippets Groups Projects
Commit db22a2a8 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

rename "provider" to "sp"

parent 1412d8a4
No related branches found
No related tags found
No related merge requests found
......@@ -261,12 +261,12 @@ sub req_select_email {
}
# Create a persistent service provider object
my $provider = AccountManager::Service->new(
my $sp = AccountManager::Service->new(
db => $self->{db},
entityid => $self->{in}->{entityid}
);
if ($provider->load(speculative => 1)) {
if ($sp->load(speculative => 1)) {
# already present in DB, nothing todo
} else {
# extract information from metadata
......@@ -288,8 +288,8 @@ sub req_select_email {
);
}
my $sps = $metadata->parse(id => $self->{in}->{entityid});
if (!@$sps) {
my $entities = $metadata->parse(id => $self->{in}->{entityid});
if (!@$entities) {
$self->{logger}->errorf(
"No such SP '%s' in metadata", $self->{in}->{entityid}
);
......@@ -301,15 +301,15 @@ sub req_select_email {
}
);
}
my $sp = $sps->[0];
my $entity = $entities->[0];
# complete persistent object
$provider->displayname($sp->{display_name});
$provider->contacts(uniq map { $_->{EmailAddress} } @{$sp->{contacts}})
if $sp->{contacts};
$sp->displayname($entity->{display_name});
$sp->contacts(uniq map { $_->{EmailAddress} } @{$entity->{contacts}})
if $entity->{contacts};
# save in DB
unless ($provider->save()) {
unless ($sp->save()) {
$self->{logger}->error("Failed to save service provider object");
$self->respond(
template => 'index.tt2.html',
......@@ -322,25 +322,25 @@ sub req_select_email {
}
# override metadata contacts if needed
my $entity = $self->{in}->{entityid};
my $id = $self->{in}->{entityid};
my $contacts =
$self->{configuration}->{$entity}->{contacts} ||
$self->{configuration}->{$id}->{contacts} ||
$self->{configuration}->{service}->{contacts};
if ($contacts) {
if ($contacts =~ /^\+(.+)/) {
# complement original contacts
$provider->contacts($provider->contacts(), split(/, */, $1));
$sp->contacts($sp->contacts(), split(/, */, $1));
} else {
# replace original contacts
$provider->contacts(split(/, */, $contacts));
$sp->contacts(split(/, */, $contacts));
}
}
$self->respond(
template => 'index.tt2.html',
data => {
provider => $provider,
content => 'select_email.tt2.html'
sp => $sp,
content => 'select_email.tt2.html'
}
);
}
......
......@@ -9,18 +9,18 @@
<div class="content clearfix">
<h2>[% lh.maketext("Select your email address") %]</h2>
<p>[% lh.maketext("Before you can create test accounts at this Identity Provider, we need to ensure you are a legitimate administrator of '[_1]'.", provider.displayname) %]</p>
<p>[% lh.maketext("Before you can create test accounts at this Identity Provider, we need to ensure you are a legitimate administrator of '[_1]'.", sp.displayname) %]</p>
[% IF provider.contacts.defined %]
[% IF sp.contacts.defined %]
<form action="[% env.SCRIPT_NAME %]" method="get">
<p>[% lh.maketext("Select the email address where an email challenge can be sent to validate your identity:") %]</p>
[% FOREACH email IN provider.contacts.sort %]
[% FOREACH email IN sp.contacts.sort %]
<input id="[% email %]" name="email" value="[% email %]" type="radio" class="required"/>
<label for="[% email %]">[% email %]</label>
<br/>
[% END %]
<p>[% lh.maketext("Those email addresses have been extracted from your service metadata.") %]</p>
<input type="hidden" name="entityid" value="[% provider.entityid %]"/>
<input type="hidden" name="entityid" value="[% sp.entityid %]"/>
<button class="button" type="submit" name="action" value="select_sp">[% lh.maketext("Previous") %]</button>
<button class="button" type="submit" name="action" value="complete_challenge">[% lh.maketext("Next") %]</button>
</form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment