Skip to content

Commit 9f9d485

Browse files
committed
URLs for plugins are mandatory (closes # 322)
Change-Id: I1783930cf984850c95edb5f395e2e66ae90ed41e
1 parent 2ac9931 commit 9f9d485

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- Don't send empty pipes and states via query param (diewald)
2525
- Fix access of iframe location in tutorials. (diewald)
2626
- Fix test that wrongly required SSL support. (diewald)
27+
- URLs for plugins are mandatory (closes # 322; hebasta)
2728

2829
0.58 2024-11-15
2930
- Cookie path is settable now (hebasta)

dev/scss/base/form.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@
170170
color: $ids-blue-1;
171171
content: '*';
172172
}
173+
174+
span.field-required{
175+
color: $ids-blue-1;
176+
}
177+
173178
}
174179

175180
.button-abort {

lib/Kalamar/Plugin/Auth.pm

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ sub register {
100100
redirectUri => 'Weiterleitungsadresse',
101101
pluginSrc => 'Beschreibung des Plugins (*.json-Datei)',
102102
homepage => 'Webseite',
103+
homepageReq => '*(Plugins)',
103104
desc => 'Kurzbeschreibung',
104105
revoke => 'Widerrufen',
105106
clientCredentials => 'Client Daten',
@@ -173,6 +174,7 @@ sub register {
173174
redirectUri => 'Redirect URI',
174175
pluginSrc => 'Declaration of the plugin (*.json file)',
175176
homepage => 'Homepage',
177+
homepageReq =>'*(Plugins)',
176178
desc => 'Short description',
177179
revoke => 'Revoke',
178180
clientCredentials => 'Client Credentials',
@@ -1264,9 +1266,16 @@ sub register {
12641266
$v->required('name', 'trim', 'not_empty')->size(3, 255);
12651267
$v->required('type')->in('PUBLIC', 'CONFIDENTIAL');
12661268
$v->required('desc', 'trim', 'not_empty')->size(3, 255);
1267-
$v->optional('url', 'trim', 'not_empty')->like(qr/^(http|$)/i);
12681269
$v->optional('redirect_uri', 'trim', 'not_empty')->like(qr/^(http|$)/i);
12691270
$v->optional('src', 'not_empty');
1271+
1272+
my $src = $v->param('src');
1273+
if ($src && ref $src && $src->size > 0){
1274+
$v->required('url', 'trim', 'not_empty')->like(qr/^(http|$)/i);
1275+
}
1276+
else{
1277+
$v->optional('url', 'trim', 'not_empty')->like(qr/^(http|$)/i);
1278+
}
12701279

12711280
$c->stash(template => 'auth/clients');
12721281

@@ -1285,8 +1294,9 @@ sub register {
12851294
};
12861295

12871296
my $type = $v->param('type');
1288-
my $src = $v->param('src');
12891297
my $src_json;
1298+
1299+
12901300

12911301
my $json_obj = {
12921302
name => $v->param('name'),
@@ -1313,7 +1323,7 @@ sub register {
13131323

13141324
# Check upload is not empty
13151325
if ($src->size > 0 && $src->filename ne '') {
1316-
1326+
13171327
# Plugins need to be confidential
13181328
if ($type ne 'CONFIDENTIAL') {
13191329
$c->notify(error => $c->loc('Auth_confidentialRequired'));

lib/Kalamar/Plugin/Auth/templates/auth/clients.html.ep

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
</div>
4848

4949
<div>
50-
%= label_for url => loc('Auth_homepage')
50+
%= label_for url => begin
51+
%=loc('Auth_homepage')
52+
%=t span =>(class => 'field-required')=> loc('Auth_homepageReq')
53+
%end
5154
%= url_field 'url', placeholder => 'https://...'
5255
</div>
5356

t/plugin/auth-oauth.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,8 @@ $t->get_ok('/settings/oauth')
489489
->text_is('label[for=name]','Name of the client application')
490490
->text_is('label[for=type]','Type of the client application')
491491
->text_is('label[for=desc]','Short description')
492-
->text_is('label[for=url]','Homepage')
492+
->text_like('label[for=url]'=> '/Homepage/')
493+
->element_exists('label[for=url] > span.field-required')
493494
->text_is('label[for=redirect_uri]','Redirect URI')
494495
->text_is('label[for=src]','Declaration of the plugin (*.json file)')
495496
->element_exists('ul.client-list')
@@ -1221,10 +1222,12 @@ my $json_post = {
12211222
name => 'Funny',
12221223
type => 'PUBLIC',
12231224
desc => 'This is my plugin application 2',
1225+
url => 'https://xyz/123',
12241226
csrf_token => $csrf,
12251227
src => 'hMMM'
12261228
};
12271229

1230+
12281231
$t->post_ok('/settings/oauth/register' => form => $json_post)
12291232
->status_is(200)
12301233
->element_exists('div.notify-error')

0 commit comments

Comments
 (0)