diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm index 7ffc24c16060fd0e172b8db22884518323c236d2..062d39e0e58943c931b43a03d9b182e8913377fa 100644 --- a/lib/AccountManager/App.pm +++ b/lib/AccountManager/App.pm @@ -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' } ); } diff --git a/templates/web/select_email.tt2.html b/templates/web/select_email.tt2.html index 0c8b32ae55bd6aefbe85fec035389be37933c24a..fb7cb51f8577328290eb0eff91e01249fe578f7f 100644 --- a/templates/web/select_email.tt2.html +++ b/templates/web/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>