Commit 1de19778 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛
Browse files

Display delete button only if allowed (#1622)

parent 36dd0019
...@@ -333,6 +333,7 @@ sub _displayRegister { ...@@ -333,6 +333,7 @@ sub _displayRegister {
} }
# Parse second factors to display delete button if allowed # Parse second factors to display delete button if allowed
my $action = '';
foreach (@$_2fDevices) { foreach (@$_2fDevices) {
if ( $_->{type} eq 'U2F' ) { if ( $_->{type} eq 'U2F' ) {
$_->{delAllowed} $_->{delAllowed}
...@@ -352,6 +353,7 @@ sub _displayRegister { ...@@ -352,6 +353,7 @@ sub _displayRegister {
&& $self->conf->{yubikey2fUserCanRemoveKey} && $self->conf->{yubikey2fUserCanRemoveKey}
&& $self->conf->{yubikey2fSelfRegistration}; && $self->conf->{yubikey2fSelfRegistration};
} }
$action ||= $_->{delAllowed};
} }
# Display template # Display template
...@@ -363,6 +365,7 @@ sub _displayRegister { ...@@ -363,6 +365,7 @@ sub _displayRegister {
SKIN => $self->conf->{portalSkin}, SKIN => $self->conf->{portalSkin},
MODULES => \@am, MODULES => \@am,
SFDEVICES => $_2fDevices, SFDEVICES => $_2fDevices,
ACTION => $action,
REG_REQUIRED => $req->data->{sfRegRequired}, REG_REQUIRED => $req->data->{sfRegRequired},
} }
); );
......
...@@ -17,7 +17,10 @@ ...@@ -17,7 +17,10 @@
<th><span trspan="type">Type</span></th> <th><span trspan="type">Type</span></th>
<th><span trspan="name">Name</span></th> <th><span trspan="name">Name</span></th>
<th><span trspan="date">Date</span></th> <th><span trspan="date">Date</span></th>
<th><span trspan="action">Action</span></th> <th>
<TMPL_IF NAME="ACTION">
<span trspan="action">Action</span></th>
</TMPL_IF>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment