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 { ...@@ -261,12 +261,12 @@ sub req_select_email {
} }
# Create a persistent service provider object # Create a persistent service provider object
my $provider = AccountManager::Service->new( my $sp = AccountManager::Service->new(
db => $self->{db}, db => $self->{db},
entityid => $self->{in}->{entityid} entityid => $self->{in}->{entityid}
); );
if ($provider->load(speculative => 1)) { if ($sp->load(speculative => 1)) {
# already present in DB, nothing todo # already present in DB, nothing todo
} else { } else {
# extract information from metadata # extract information from metadata
...@@ -288,8 +288,8 @@ sub req_select_email { ...@@ -288,8 +288,8 @@ sub req_select_email {
); );
} }
my $sps = $metadata->parse(id => $self->{in}->{entityid}); my $entities = $metadata->parse(id => $self->{in}->{entityid});
if (!@$sps) { if (!@$entities) {
$self->{logger}->errorf( $self->{logger}->errorf(
"No such SP '%s' in metadata", $self->{in}->{entityid} "No such SP '%s' in metadata", $self->{in}->{entityid}
); );
...@@ -301,15 +301,15 @@ sub req_select_email { ...@@ -301,15 +301,15 @@ sub req_select_email {
} }
); );
} }
my $sp = $sps->[0]; my $entity = $entities->[0];
# complete persistent object # complete persistent object
$provider->displayname($sp->{display_name}); $sp->displayname($entity->{display_name});
$provider->contacts(uniq map { $_->{EmailAddress} } @{$sp->{contacts}}) $sp->contacts(uniq map { $_->{EmailAddress} } @{$entity->{contacts}})
if $sp->{contacts}; if $entity->{contacts};
# save in DB # save in DB
unless ($provider->save()) { unless ($sp->save()) {
$self->{logger}->error("Failed to save service provider object"); $self->{logger}->error("Failed to save service provider object");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'index.tt2.html',
...@@ -322,25 +322,25 @@ sub req_select_email { ...@@ -322,25 +322,25 @@ sub req_select_email {
} }
# override metadata contacts if needed # override metadata contacts if needed
my $entity = $self->{in}->{entityid}; my $id = $self->{in}->{entityid};
my $contacts = my $contacts =
$self->{configuration}->{$entity}->{contacts} || $self->{configuration}->{$id}->{contacts} ||
$self->{configuration}->{service}->{contacts}; $self->{configuration}->{service}->{contacts};
if ($contacts) { if ($contacts) {
if ($contacts =~ /^\+(.+)/) { if ($contacts =~ /^\+(.+)/) {
# complement original contacts # complement original contacts
$provider->contacts($provider->contacts(), split(/, */, $1)); $sp->contacts($sp->contacts(), split(/, */, $1));
} else { } else {
# replace original contacts # replace original contacts
$provider->contacts(split(/, */, $contacts)); $sp->contacts(split(/, */, $contacts));
} }
} }
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'index.tt2.html',
data => { data => {
provider => $provider, sp => $sp,
content => 'select_email.tt2.html' content => 'select_email.tt2.html'
} }
); );
} }
......
...@@ -9,18 +9,18 @@ ...@@ -9,18 +9,18 @@
<div class="content clearfix"> <div class="content clearfix">
<h2>[% lh.maketext("Select your email address") %]</h2> <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"> <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> <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"/> <input id="[% email %]" name="email" value="[% email %]" type="radio" class="required"/>
<label for="[% email %]">[% email %]</label> <label for="[% email %]">[% email %]</label>
<br/> <br/>
[% END %] [% END %]
<p>[% lh.maketext("Those email addresses have been extracted from your service metadata.") %]</p> <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="select_sp">[% lh.maketext("Previous") %]</button>
<button class="button" type="submit" name="action" value="complete_challenge">[% lh.maketext("Next") %]</button> <button class="button" type="submit" name="action" value="complete_challenge">[% lh.maketext("Next") %]</button>
</form> </form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment