Skip to content

Commit 79429dc

Browse files
authored
Added missing links in templates (hestiacp#842)
* Added missing links in templates Improved v-list-user-ssh-key and Filemanager SSH is not visible any more * Removed non required and sync output with json sshkey=$([[ -n $l && ${l###} = $l ]] && ssh-keygen -l -f <(echo $l)); Will filter the sftp keys out of the list * Changes to title in link
1 parent 1f99c33 commit 79429dc

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

bin/v-list-user-ssh-key

100644100755
Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@ json_list() {
2424
objects=$(echo "$keys" |wc -l)
2525
echo "{"
2626
for str in $keys; do
27-
KEY=$(echo $str | awk '{print $(NF-1)}')
28-
ID=$(echo $str | awk '{print $NF}')
27+
KEY=$(echo $str | awk '{print $(NF-2)}')
28+
ID=$(echo $str | awk '{print $(NF-1)}')
2929
echo -n ' "'$ID'": {
3030
"ID": "'$ID'",
3131
"KEY": "'$KEY'"
3232
}'
3333
if [ "$i" -lt "$objects" ]; then
3434
echo ','
35-
else
36-
echo
3735
fi
3836
((i++))
3937
done
@@ -45,8 +43,8 @@ shell_list() {
4543
echo "ID~KEY"
4644
echo "----~----~---"
4745
for str in $keys; do
48-
KEY=$(echo $str | awk '{print $(NF-1)}')
49-
ID=$(echo $str | awk '{print $NF}')
46+
KEY=$(echo $str | awk '{print $(NF-2)}')
47+
ID=$(echo $str | awk '{print $(NF-1)}')
5048
echo "$ID~$KEY"
5149
done
5250
}
@@ -55,8 +53,8 @@ shell_list() {
5553
plain_list() {
5654
IFS=$'\n'
5755
for str in $keys; do
58-
KEY=$(echo $str | awk '{print $(NF-1)}')
59-
ID=$(echo $str | awk '{print $NF}')
56+
KEY=$(echo $str | awk '{print $(NF-2)}')
57+
ID=$(echo $str | awk '{print $(NF-1)}')
6058
echo -e "$ID\t$KEY"
6159
done
6260
}
@@ -66,8 +64,8 @@ csv_list() {
6664
IFS=$'\n'
6765
echo "ID,KEY"
6866
for str in $keys; do
69-
KEY=$(echo $str | awk '{print $(NF-1)}')
70-
ID=$(echo $str | awk '{print $NF}')
67+
KEY=$(echo $str | awk '{print $(NF-2)}')
68+
ID=$(echo $str | awk '{print $(NF-1)}')
7169
echo "\"$ID\",\"$KEY\""
7270
done
7371
}
@@ -89,9 +87,17 @@ is_object_unsuspended 'user' 'USER' "$user"
8987
if [ ! -f "$HOMEDIR/$user/.ssh/authorized_keys" ]; then
9088
exit
9189
fi
92-
# Parsing backup config
93-
#cat "$HOMEDIR/$user/.ssh/authorized_keys"
94-
keys=$(cat "$HOMEDIR/$user/.ssh/authorized_keys")
90+
91+
first_loop=1
92+
while read l; do
93+
sshkey=$([[ -n $l && ${l###} = $l ]] && ssh-keygen -l -f <(echo $l));
94+
if [ ! -z "$sshkey" ]
95+
then
96+
(( $first_loop )) && keys="$sshkey" || keys="$keys"$'\n'"$sshkey"
97+
unset first_loop
98+
fi
99+
done < "$HOMEDIR/$user/.ssh/authorized_keys"
100+
95101

96102
# Listing data
97103
case $format in

web/templates/admin/edit_user.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div class="l-sort clearfix">
33
<div class="l-unit-toolbar__buttonstrip">
44
<a class="ui-button cancel" id="btn-back" href="/list/user/"><i class="fas fa-arrow-left status-icon blue"></i> <?=__('Back')?></a>
5+
<a href="/list/key" id="btn-create" class="ui-button cancel" title="<?=__('SSH_KEY');?>"><i class="fas fa-key status-icon green"></i><?=__('SSH KEY')?></a>
56
</div>
67
<div class="l-unit-toolbar__buttonstrip float-right">
78
<a href="#" class="ui-button" title="<?=__('Save')?>" data-action="submit" data-id="vstobjects"><i class="fas fa-save status-icon purple"></i> <?=__('Save')?></a>

web/templates/admin/list_key.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</div>
4545
</div>
4646
</div>
47-
<div class="clearfix l-unit__stat-col--left wide-7"><b><?=htmlspecialchars(substr($data[$key]['KEY'],0,50).'.....'.substr($data[$key]['ID'], -10,10), ENT_QUOTES);?></b></div>
47+
<div class="clearfix l-unit__stat-col--left wide-7"><b><?=htmlspecialchars($data[$key]['KEY'], ENT_QUOTES);?></b></div>
4848
</div>
4949
</div>
5050
<?}?>

web/templates/user/edit_user.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div class="l-sort clearfix">
33
<div class="l-unit-toolbar__buttonstrip">
44
<a class="ui-button cancel" id="btn-back" href="/list/user/"><i class="fas fa-arrow-left status-icon blue"></i> <?=__('Back')?></a>
5+
<a href="/list/key" id="btn-create" class="ui-button cancel" title="<?=__('SSH_KEY');?>"><i class="fas fa-key status-icon green"></i><?=__('SSH KEY')?></a>
56
</div>
67
<div class="l-unit-toolbar__buttonstrip float-right">
78
<a href="#" class="ui-button" title="<?=__('Save')?>" data-action="submit" data-id="vstobjects"><i class="fas fa-save status-icon purple"></i> <?=__('Save')?></a>

0 commit comments

Comments
 (0)