Jaap Marcus 5 лет назад
Родитель
Сommit
e97b08ed8d
3 измененных файлов с 66 добавлено и 16 удалено
  1. 3 0
      bin/v-delete-user-2fa
  2. 43 0
      web/reset2fa/index.php
  3. 20 16
      web/templates/reset2fa.html

+ 3 - 0
bin/v-delete-user-2fa

@@ -50,4 +50,7 @@ sed -i '/QRCODE=/d' $USER_DATA/user.conf
 #                       Hestia                             #
 #----------------------------------------------------------#
 
+log_history "2FA Disabled for $user"
+log_event "$OK" "$ARGUMENTS"
+
 exit

+ 43 - 0
web/reset2fa/index.php

@@ -0,0 +1,43 @@
+<?php
+session_start();
+define('NO_AUTH_REQUIRED',true);
+$TAB = 'RESET PASSWORD';
+
+if (isset($_SESSION['user'])) {
+    header("Location: /list/user");
+}
+
+// Main include
+include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
+
+// Detect language
+if (empty($_SESSION['language'])){ 
+    $_SESSION['language'] = detect_user_language();
+}
+//Check values
+if(!empty($_POST['user']) && !empty($_POST['twofa'])){
+    $error = true;
+    $v_user = escapeshellarg($_POST['user']);
+    $user = $_POST['user'];
+    $twofa = $_POST['twofa'];
+    $cmd="/usr/bin/sudo /usr/local/hestia/bin/v-list-user";
+    exec ($cmd." ".$v_user." json", $output, $return_var);
+    if ( $return_var == 0 ) {
+        $data = json_decode(implode('', $output), true);
+        if($data[$user]['TWOFA'] == $twofa){
+            $success = true;
+            $cmd="/usr/bin/sudo /usr/local/hestia/bin/v-delete-user-2fa";
+            exec ($cmd." ".$v_user." json", $output, $return_var);
+        }else{
+            sleep(5);   
+        }
+    }else{
+        sleep(5);
+    }
+    
+}
+
+require_once '../templates/header.html';
+require_once '../templates/reset2fa.html';
+
+?>

+ 20 - 16
web/templates/reset2fa.html

@@ -4,26 +4,26 @@
                     <td>
                         <table>
                             <tr>
-                                <td style="padding: 0 10px 0 42px; height: 280px; width: 170px;">
-                                    <a href="/"><img border=0 src="/images/logo.png" width="124px" height="46px" alt="Hestia Control Panel" /></a>
+                                <td style="padding: 22px 30px 0 42px; height: 280px; width: 170px;">
+                                    <a href="/"><img border=0 src="/images/logo.png" alt="Hestia Control Panel" style="margin: 20px; margin-top: 64px;" /></a>
                                 </td>
-                                <td style="padding: 10px 0 0 0;">
-                                    <?php if ($success) { ?>
-                                    <table class="login-box">
-                                        <tr>
-                                        <td style="padding: 12px 0 0 2px;">
-                                            <?php print __('2FA Reset successfully.'); ?>
-                                        </td>
-                                        </tr>
-                                    </table>
-                                    <?php } else { ?>
-                                    <form method="post" action="/reset2fa/">
+                                <td style="padding: 40px 60px 0 0;" class="animated fadeIn">
+                                    <?php if($success){?>
                                         <table class="login-box">
                                             <tr>
                                             <td style="padding: 12px 0 0 2px;">
-                                                <?php print __('RESET_NOTICE');?>
+                                            <?php print __('2FA Reset successfully.'); ?>
                                             </td>
                                             </tr>
+                                        </table>
+                                        <?php }else{ ?>
+                                        <form method="post" action="/reset2fa/">
+                                        <table class="login-box">
+                                            <tr>
+                                                <td style="padding: 12px 0 0 2px;" class="login-welcome">
+                                                    <?php print __('Reset 2FA');?>
+                                                </td>
+                                            </tr>
                                             <tr>
                                                 <td style="padding: 12px 0 0 2px;">
                                                     <?php print __('Username');?>
@@ -44,10 +44,15 @@
                                                     <input tabindex="1" type="text" size="20px" style="width:240px" name="twofa" class="vst-input">
                                                 </td>
                                             </tr>
+                                            <tr>
+                                                <td style="padding: 12px 0 0 2px;">
+                                                    <?php print __('RESET_NOTICE');?>
+                                                </td>
+                                            </tr>
                                             <tr>
                                                 <td style="padding: 20px 0 12px 0;">
+                                                    <input type="button" class="button cancel" value="<?php print __('Back');?>" onclick="location.href='/login/'">&nbsp;&nbsp;
                                                     <input tabindex="2" type="submit" value="<?php print __('Submit');?>" class="button">
-                                                    <input type="button" class="button cancel" value="<?php print __('Back');?>" onclick="location.href='/login/'">
                                                 </td>
                                             </tr>
                                         </table>
@@ -59,7 +64,6 @@
                                 <td colspan=2>
                                     <div class="login-bottom">
                                         <div style="height:20px"><?php if (isset($ERROR)) echo $ERROR ?></div>
-                                        <a class="hestiacp" href="https://www.hestiacp.com" >hestiacp.com</a>
                                     </div>
                                 </td>
                             </tr>