diff --git a/conf/manager.sql b/conf/manager.sql index e2ecaa0fd13336040b14fc9c3e9cefd6be481468..c373dbe5a5e89231cbbc11ed2ca3fd7f05cef64a 100644 --- a/conf/manager.sql +++ b/conf/manager.sql @@ -14,6 +14,7 @@ CREATE TABLE tokens ( CREATE TABLE services ( id bigint(20) NOT NULL AUTO_INCREMENT, entityid varchar(200) NOT NULL, + url varchar(200) DEFAULT NULL, displayname varchar(500) DEFAULT NULL, contacts varchar(2000) DEFAULT NULL, PRIMARY KEY (id), diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm index 5d2eab71463fb13a5264f084b6c043ce52a9e4f2..0e5c05d106c2548db75475768dc2c5cf0ab52832 100644 --- a/lib/AccountManager/App.pm +++ b/lib/AccountManager/App.pm @@ -344,6 +344,7 @@ sub req_select_email { # complete persistent object $sp->displayname($entity->{display_name}); + $sp->url($entity->{url}); $sp->contacts(uniq map { $_->{EmailAddress} } @{$entity->{contacts}}) if $entity->{contacts}; @@ -570,6 +571,15 @@ sub req_create_accounts { $self->check_token(token => $token, entityid => $entityid); + my $sp = AccountManager::ServiceProvider->new( + db => $self->{db}, + entityid => $entityid, + ); + $self->abort( + log => sprintf("No such SP '%s' in database", $entityid), + user => "no_such_entity" + ) if !$sp->load(speculative => 1); + ## create test accounts my @accounts; @@ -645,6 +655,7 @@ sub req_create_accounts { action => 'create_accounts', accounts => \@accounts, entityid => $entityid, + url => $sp->url(), email => $email, key => $key, token => $download_token->secret(), diff --git a/lib/AccountManager/L10N/fr.pm b/lib/AccountManager/L10N/fr.pm index 2dfedd1f3b50012a022ea26eb6739cff264c5c7c..954d94422f0442e1fd35161ef8a6aa8c99303bd5 100644 --- a/lib/AccountManager/L10N/fr.pm +++ b/lib/AccountManager/L10N/fr.pm @@ -259,8 +259,8 @@ msgid "Validation token: %1" msgstr "Code de validation: %1" #: templates/web/edugain/create_accounts.tt2.html:10 templates/web/renater/create_accounts.tt2.html:12 -msgid "You can now use these test accounts to login at your service provider." -msgstr "Vous pouvez maintenant utiliser ces comptes pour vous identifier sur votre fournisseur de service." +msgid "You can now use these test accounts to login at your <a href=\"%1\">service provider</a>." +msgstr "Vous pouvez maintenant utiliser ces comptes pour vous identifier sur votre <a href=\"%1\">fournisseur de service</a>." #: templates/web/edugain/errors.tt2.html:38 templates/web/renater/errors.tt2.html:37 msgid "You can report the issue to the administrators" diff --git a/lib/AccountManager/Metadata.pm b/lib/AccountManager/Metadata.pm index 9f57a283fb3d1bdefeb9bc3db64e33df447cb089..e83ec950e731f60c12a83a7073af9384f46becb5 100644 --- a/lib/AccountManager/Metadata.pm +++ b/lib/AccountManager/Metadata.pm @@ -138,7 +138,12 @@ sub parse { my %names = map { $_->getAttribute('xml:lang') => $_->textContent() } @names; - $data->{name} = $names{en} ? $names{en} : $names[0]; + $data->{name} = $names{en} ? $names{en} : $names[0]->textContent(); + my @urls = $uiinfo->getChildrenByLocalName('InformationURL'); + my %urls = + map { $_->getAttribute('xml:lang') => $_->textContent() } + @urls; + $data->{url} = $urls{en} ? $urls{en} : $urls[0]->textContent(); } } elsif ($child->localname() eq 'Extensions') { diff --git a/lib/AccountManager/ServiceProvider.pm b/lib/AccountManager/ServiceProvider.pm index 8d83daa4c486fd2a9e3cc77dd4aa530f5acc295c..c501112b324edbbbde3ff706ed50158220d1c5e6 100644 --- a/lib/AccountManager/ServiceProvider.pm +++ b/lib/AccountManager/ServiceProvider.pm @@ -15,6 +15,7 @@ __PACKAGE__->meta->setup( id => { type => 'bigserial', not_null => 1 }, entityid => { type => 'varchar', length => 200, not_null => 1 }, displayname => { type => 'varchar', length => 500 }, + url => { type => 'varchar', length => 200 }, contacts => { type => 'array' }, ], diff --git a/templates/web/edugain/create_accounts.tt2.html b/templates/web/edugain/create_accounts.tt2.html index f828c16e58f087f7184f2e981c0f91a8f89f4b29..9f582e597af27e790abb65fabca3f757cacaecb5 100644 --- a/templates/web/edugain/create_accounts.tt2.html +++ b/templates/web/edugain/create_accounts.tt2.html @@ -7,8 +7,8 @@ <h2>[% lh.maketext("Test accounts created") %]</h2> <p> - [% lh.maketext("You can now use these test accounts to login at your service provider.") %] - [% lh.maketext("To do so, select <strong>[_1]</strong> when choosing an identity provider.", idp_displayname) %] +[% lh.maketext("You can now use these test accounts to login at your <a href=\"[_1]\">service provider</a>.", url) %] +[% lh.maketext("To do so, select <strong>[_1]</strong> when choosing an identity provider.", idp_displayname) %] </p> <p><a class="button" href="[% app.url %]?action=download_accounts&entityid=[% entityid %]&token=[% token %]&key=[% key %]">[% lh.maketext("Download in CSV format") %]</a></p> diff --git a/templates/web/renater/create_accounts.tt2.html b/templates/web/renater/create_accounts.tt2.html index b017cb86acea4956b17a95577c0d41a544cfae53..514cfe0f8ce52d7c3022630ac829fd1f47afff97 100644 --- a/templates/web/renater/create_accounts.tt2.html +++ b/templates/web/renater/create_accounts.tt2.html @@ -9,8 +9,8 @@ <h2>[% lh.maketext("Test accounts created") %]</h2> <p> - [% lh.maketext("You can now use these test accounts to login at your service provider.") %] - [% lh.maketext("To do so, select <strong>[_1]</strong> when choosing an identity provider.", idp_displayname) %] +[% lh.maketext("You can now use these test accounts to login at your <a href=\"[_1]\">service provider</a>.", url) %] +[% lh.maketext("To do so, select <strong>[_1]</strong> when choosing an identity provider.", idp_displayname) %] </p> <p><a class="button" href="[% app.url %]?action=download_accounts&entityid=[% entityid %]&token=[% token %]&key=[% key %]">[% lh.maketext("Download in CSV format") %]</a></p>