]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - settings/user-edit.php
Move some PHP files from ./ to ./inc: common, connection, header, footer
[irc/unrealircd/unrealircd-webpanel.git] / settings / user-edit.php
index 966a38ff1c2116c036db7b03ca1dbe31953f1a48..e95307f8f9fa2aeb4ee1bbc5d9e708b1d18682b9 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-require_once "../common.php";
-require_once "../header.php";
+require_once "../inc/common.php";
+require_once "../inc/header.php";
 do_log($_POST);
 
 $us = unreal_get_current_user();
@@ -31,12 +31,15 @@ if ($postbutton && is_array($permissions) && $caneditpermissions
 
 if ($postbutton && $can_edit_profile)
 {
+    // Goes via core:
     $array['update_fname'] = (isset($_POST['first_name']) && strlen($_POST['first_name'])) ? $_POST['first_name'] : false;
     $array['update_lname'] = (isset($_POST['last_name']) && strlen($_POST['last_name'])) ? $_POST['last_name'] : false;
     $array['update_bio'] = (isset($_POST['bio']) && strlen($_POST['bio'])) ? $_POST['bio'] : false;
     $array['update_email'] = (isset($_POST['email']) && strlen($_POST['email'])) ? $_POST['email'] : false;
     $array['update_pass'] = (isset($_POST['password']) && strlen($_POST['password'])) ? $_POST['password'] : false;
     $array['update_pass_conf'] = (isset($_POST['passwordconfirm']) && strlen($_POST['passwordconfirm'])) ? $_POST['passwordconfirm'] : false;
+    // Goes via meta:
+    $session_timeout = (isset($_POST['session_timeout']) && strlen($_POST['session_timeout'])) ? $_POST['session_timeout'] : 3600;
 
     if (!$array['update_pass'])
     {
@@ -45,7 +48,7 @@ if ($postbutton && $can_edit_profile)
     }
     elseif ($array['update_pass'] == $array['update_pass_conf'])
     {
-        $array['update_pass_conf'] = password_hash($array['update_pass_conf'], PASSWORD_ARGON2ID);
+        $array['update_pass_conf'] = PanelUser::password_hash($array['update_pass_conf']);
         unset($array['update_pass']);
     }
     else
@@ -55,6 +58,7 @@ if ($postbutton && $can_edit_profile)
         unset($array['update_pass_conf']);
     }
     $edit_user->update_core_info($array);
+    $edit_user->add_meta("session_timeout", $session_timeout);
     $edit_user = new PanelUser($edit_user->username);
 }
 ?>
@@ -76,47 +80,55 @@ if ($postbutton && $can_edit_profile)
 <br><br>
 <div class="input-group mb-3">
     <div class="input-group-prepend">
-        <span class="input-group-text" style="width: 100px;">@</span>
+        <span class="input-group-text" style="width: 175px;">@</span>
     </div><input disabled type="text" class="form-control" name="username" id="username" placeholder="<?php echo $edit_user->username; ?>">
 </div>
 
 <div class="input-group mb-3">
     <div class="input-group-prepend">
-        <span class="input-group-text" style="width: 100px;">First Name</span>
+        <span class="input-group-text" style="width: 175px;">First Name</span>
     </div><input <?php echo $can_edit; ?> type="text" class="form-control" name="first_name" id="first_name" placeholder="<?php echo $edit_user->first_name; ?>">
 </div>
 
 
 <div class="input-group mb-3">
     <div class="input-group-prepend">
-        <span class="input-group-text" style="width: 100px;">Last Name</span>
+        <span class="input-group-text" style="width: 175px;">Last Name</span>
     </div><input <?php echo $can_edit; ?> type="text" class="form-control" name="last_name" id="last_name" placeholder="<?php echo $edit_user->last_name; ?>">
 </div>
 
 
 <div class="input-group mb-3">
     <div class="input-group-prepend">
-        <span class="input-group-text" style="width: 100px;">Bio</span>
+        <span class="input-group-text" style="width: 175px;">Bio</span>
     </div><textarea <?php echo $can_edit; ?> class="form-control" name="bio" id="username"><?php echo $edit_user->bio; ?></textarea>
 </div>
 
 
 <div class="input-group mb-3">
     <div class="input-group-prepend">
-        <span class="input-group-text" style="width: 100px;">Email</span>
+        <span class="input-group-text" style="width: 175px;">Email</span>
     </div><input <?php echo $can_edit; ?> type="text" class="form-control" name="email" id="email" autocomplete="off" value="<?php echo $edit_user->email; ?>">
 </div>
 
 <div class="input-group mb-3">
     <div class="input-group-prepend">
-        <span class="input-group-text" style="width: 150px;">New Password</span>
+        <span class="input-group-text" style="width: 175px;">Session timeout</span>
+    </div><input <?php echo $can_edit; ?> type="text" class="form-control" name="session_timeout" id="session_timeout" autocomplete="off" value="<?php echo $edit_user->user_meta['session_timeout'] ?? 3600; ?>">
+</div>
+
+<div class="input-group mb-3">
+    <div class="input-group-prepend">
+        <span class="input-group-text" style="width: 175px;">New Password</span>
     </div><input <?php echo $can_edit; ?> type="password" class="form-control" name="password" id="password" autocomplete="off">
 </div><div class="input-group mb-3">
     <div class="input-group-prepend">
-        <span class="input-group-text" style="width: 150px;">Confirm Password</span>
+        <span class="input-group-text" style="width: 175px;">Confirm Password</span>
     </div><input <?php echo $can_edit; ?> type="password" class="form-control" name="passwordconfirm" id="passwordconfirm" autocomplete="off">
 </div>
 
 <br>
 <button type="submit" name="update_user" class="btn btn-primary">Save Changes</button><br>
-</form>
\ No newline at end of file
+</form>
+<?php
+require_once "../inc/footer.php";