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

extract service URL, and provide a direct access link to user

parent 2fb08fe8
Branches
Tags
No related merge requests found
...@@ -14,6 +14,7 @@ CREATE TABLE tokens ( ...@@ -14,6 +14,7 @@ CREATE TABLE tokens (
CREATE TABLE services ( CREATE TABLE services (
id bigint(20) NOT NULL AUTO_INCREMENT, id bigint(20) NOT NULL AUTO_INCREMENT,
entityid varchar(200) NOT NULL, entityid varchar(200) NOT NULL,
url varchar(200) DEFAULT NULL,
displayname varchar(500) DEFAULT NULL, displayname varchar(500) DEFAULT NULL,
contacts varchar(2000) DEFAULT NULL, contacts varchar(2000) DEFAULT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
......
...@@ -344,6 +344,7 @@ sub req_select_email { ...@@ -344,6 +344,7 @@ sub req_select_email {
# complete persistent object # complete persistent object
$sp->displayname($entity->{display_name}); $sp->displayname($entity->{display_name});
$sp->url($entity->{url});
$sp->contacts(uniq map { $_->{EmailAddress} } @{$entity->{contacts}}) $sp->contacts(uniq map { $_->{EmailAddress} } @{$entity->{contacts}})
if $entity->{contacts}; if $entity->{contacts};
...@@ -570,6 +571,15 @@ sub req_create_accounts { ...@@ -570,6 +571,15 @@ sub req_create_accounts {
$self->check_token(token => $token, entityid => $entityid); $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 ## create test accounts
my @accounts; my @accounts;
...@@ -645,6 +655,7 @@ sub req_create_accounts { ...@@ -645,6 +655,7 @@ sub req_create_accounts {
action => 'create_accounts', action => 'create_accounts',
accounts => \@accounts, accounts => \@accounts,
entityid => $entityid, entityid => $entityid,
url => $sp->url(),
email => $email, email => $email,
key => $key, key => $key,
token => $download_token->secret(), token => $download_token->secret(),
......
...@@ -259,8 +259,8 @@ msgid "Validation token: %1" ...@@ -259,8 +259,8 @@ msgid "Validation token: %1"
msgstr "Code de validation: %1" msgstr "Code de validation: %1"
#: templates/web/edugain/create_accounts.tt2.html:10 templates/web/renater/create_accounts.tt2.html:12 #: 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." 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 fournisseur de service." 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 #: templates/web/edugain/errors.tt2.html:38 templates/web/renater/errors.tt2.html:37
msgid "You can report the issue to the administrators" msgid "You can report the issue to the administrators"
......
...@@ -138,7 +138,12 @@ sub parse { ...@@ -138,7 +138,12 @@ sub parse {
my %names = my %names =
map { $_->getAttribute('xml:lang') => $_->textContent() } map { $_->getAttribute('xml:lang') => $_->textContent() }
@names; @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') { } elsif ($child->localname() eq 'Extensions') {
......
...@@ -15,6 +15,7 @@ __PACKAGE__->meta->setup( ...@@ -15,6 +15,7 @@ __PACKAGE__->meta->setup(
id => { type => 'bigserial', not_null => 1 }, id => { type => 'bigserial', not_null => 1 },
entityid => { type => 'varchar', length => 200, not_null => 1 }, entityid => { type => 'varchar', length => 200, not_null => 1 },
displayname => { type => 'varchar', length => 500 }, displayname => { type => 'varchar', length => 500 },
url => { type => 'varchar', length => 200 },
contacts => { type => 'array' }, contacts => { type => 'array' },
], ],
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<h2>[% lh.maketext("Test accounts created") %]</h2> <h2>[% lh.maketext("Test accounts created") %]</h2>
<p> <p>
[% lh.maketext("You can now use these test accounts to login at your service provider.") %] [% 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) %] [% lh.maketext("To do so, select <strong>[_1]</strong> when choosing an identity provider.", idp_displayname) %]
</p> </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> <p><a class="button" href="[% app.url %]?action=download_accounts&entityid=[% entityid %]&token=[% token %]&key=[% key %]">[% lh.maketext("Download in CSV format") %]</a></p>
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<h2>[% lh.maketext("Test accounts created") %]</h2> <h2>[% lh.maketext("Test accounts created") %]</h2>
<p> <p>
[% lh.maketext("You can now use these test accounts to login at your service provider.") %] [% 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) %] [% lh.maketext("To do so, select <strong>[_1]</strong> when choosing an identity provider.", idp_displayname) %]
</p> </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> <p><a class="button" href="[% app.url %]?action=download_accounts&entityid=[% entityid %]&token=[% token %]&key=[% key %]">[% lh.maketext("Download in CSV format") %]</a></p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment