2023-07-17 19:15:18 +00:00
< ? php declare ( strict_types = 1 ); ?>
2023-06-15 01:35:42 +00:00
< p >
< ? = _ ( 'In addition to your password, you can also access your SFTP space using Ed25519 SSH keys. A key can be granted modification rights to the full space (<code>/</code>) or to any arbitrary subdirectory. A key is always allowed to list any directory content.' ) ?>
</ p >
2023-10-28 16:43:08 +00:00
< p >
< ? = _ ( 'Changes only affect new SFTP sessions.' ) ?>
</ p >
2023-06-15 01:35:42 +00:00
< form method = " post " >
< datalist id = " dirs " >
< option value = " / " ></ option >
< ? php
foreach ( listFsDirs ( $_SESSION [ 'id' ] ? ? '' ) as $dir )
echo ' <option value="/' . $dir . '"></option>' . LF ;
?>
</ datalist >
< ? php
foreach ( array_slice ( array_merge ( query ( 'select' , 'ssh-keys' , [ 'username' => $_SESSION [ 'id' ] ? ? '' ]), [[ 'key' => '' , 'username' => '' , 'directory' => '/' ]]), 0 , 8 ) as $i => $ssh_key ) {
?>
< fieldset >
< legend >< ? = ( $ssh_key [ 'key' ] === '' ) ? _ ( 'Add new SSH key access' ) : _ ( 'SSH key access' ) ?> </legend>
< div >
2023-06-24 14:54:36 +00:00
< label for = " public-key<?= $i ?> " >< ? = _ ( 'Public key' ) ?> </label><br>
< code > ssh - ed15519 < input pattern = " <?= ED25519_PUBKEY_REGEX ?> " placeholder = " AAAAC3NzaC1lZDI1NTE5AAAAI<?= substr(base64_encode(random_bytes(32)), 0, 43) ?> " id = " public-key<?= $i ?> " name = " keys[<?= $i ?>][public-key] " value = " <?= $ssh_key['key'] ?> " type = " text " ></ code >
2023-06-15 01:35:42 +00:00
</ div >
< div >
2023-06-24 14:54:36 +00:00
< label for = " dir<?= $i ?> " >< ? = _ ( 'Allowed directory' ) ?> </label><br>
< input list = " dirs " placeholder = " / " value = " <?= htmlspecialchars( $ssh_key['directory'] ) ?> " id = " dir<?= $i ?> " name = " keys[<?= $i ?>][dir] " type = " text " >
2023-06-15 01:35:42 +00:00
</ div >
</ fieldset >
< ? php
}
?>
< input type = " submit " value = " <?= _('Update') ?> " >
</ form >