]> git.p6c8.net - jirafeau/jirafeau.git/blobdiff - index.php
Merge branch 'patch-1' into 'show_password_box'
[jirafeau/jirafeau.git] / index.php
index 435e059711db7532e24bb67c6c8ef37f1c5dee49..2b840135b99ac868570293f734d90aeb75fbd3f7 100644 (file)
--- a/index.php
+++ b/index.php
@@ -25,7 +25,9 @@ require(JIRAFEAU_ROOT . 'lib/settings.php');
 require(JIRAFEAU_ROOT . 'lib/functions.php');
 require(JIRAFEAU_ROOT . 'lib/lang.php');
 
-if ($cfg['download_password_requirement'] === "generated") {
+$download_pass = null;
+
+if ($cfg['download_password_requirement'] === 'generated') {
     $download_pass = jirafeau_gen_download_pass($cfg['download_password_gen_len'], $cfg['download_password_gen_chars']);
 }
 
@@ -102,7 +104,7 @@ elseif (true === jirafeau_challenge_upload_ip($cfg, get_ip_address($cfg))) {
 
 ?>
 
-<?php jirafeau_create_upload_finished_box($cfg['preview']); ?>
+<?php jirafeau_create_upload_finished_box($cfg['preview'], $download_pass); ?>
 
 <div id="uploading">
     <p>
@@ -161,7 +163,8 @@ if ($cfg['download_password_requirement'] === 'generated') {
     if ($cfg['download_password_requirement'] === 'required') {
         echo ' required';
     }
-    echo '/></td></tr>';
+    echo ' /> <input type="checkbox" id="show_password"> <label for="show_password">Show password</label>';
+    echo '</td></tr>';
 }?>
         <tr>
         <td><label for="select_time"><?php echo t('TIME_LIM') . ':'; ?></label></td>
@@ -223,5 +226,12 @@ if ($max_size > 0) {
     addCopyListener('delete_link_button', 'delete_link');
     addTextCopyListener('password_copy_button', 'output_key');
 // @license-end
+// show password toggle
+    document.getElementById('show_password')?.addEventListener('change', function() {
+        const pwd = document.getElementById('input_key');
+        if (pwd) {
+            pwd.type = this.checked ? 'text' : 'password';
+        }
+    });
 </script>
 <?php require(JIRAFEAU_ROOT . 'lib/template/footer.php'); ?>

patrick-canterino.de