merge /users
This commit is contained in:
parent
623bc77304
commit
bbe1f7564b
|
@ -11,12 +11,11 @@ $LANG['confirm'] = 'Are you sure you want to delete this?\n';
|
|||
$LANG['confirm_domain'] = 'Do you really want to delete all records for this domain?\nThis can not be undone! ';
|
||||
$LANG['check_update'] = 'Check for update';
|
||||
|
||||
$LANG['Login_welcome'] = 'Mail admins login here to administer your domain';
|
||||
$LANG['Login_welcome'] = 'Login to OpenSMTPD Admin';
|
||||
$LANG['Login_username'] = 'Login (email)';
|
||||
$LANG['Login_password'] = 'Password';
|
||||
$LANG['Login_button'] = 'Login';
|
||||
$LANG['Login_incorrect'] = '<span class="error_msg">Your login or password is not correct.</span>';
|
||||
$LANG['Login_login_users'] = 'Users click here to login to the user section.';
|
||||
|
||||
$LANG['Menu_list_domain'] = 'List Domains';
|
||||
$LANG['Menu_list_virtual'] = 'List Virtuals';
|
||||
|
@ -30,6 +29,8 @@ $LANG['Menu_add_alias'] = 'Add Alias';
|
|||
$LANG['Menu_add_mailbox'] = 'Add Mailbox';
|
||||
$LANG['Menu_viewlog'] = 'View Log';
|
||||
$LANG['Menu_logout'] = 'Logout';
|
||||
$LANG['Menu_user_password'] = 'Change Password';
|
||||
$LANG['Menu_user_vacation'] = 'Auto Response';
|
||||
|
||||
$LANG['List_created'] = 'Created';
|
||||
$LANG['List_modified'] = 'Last Modified';
|
||||
|
@ -188,30 +189,19 @@ $LANG['AdminEdit_admin_result_succes'] = 'Admin has been modified.';
|
|||
$LANG['Role_admin_welcome'] = 'Add a new ';
|
||||
$LANG['Role_admin_warning'] = '<h3>Make sure you remove or protect this file when you are done.</h3>';
|
||||
|
||||
$LANG['UsersLogin_welcome'] = 'Mailbox users login to change your password and aliases';
|
||||
$LANG['UsersLogin_username'] = 'Login (email)';
|
||||
$LANG['UsersLogin_password'] = 'Password';
|
||||
$LANG['UsersLogin_button'] = 'Login';
|
||||
$LANG['UsersLogin_username_incorrect'] = 'Your login is not correct. Make sure that you login with your email address.';
|
||||
$LANG['UsersLogin_password_incorrect'] = 'Your password is not correct.';
|
||||
|
||||
$LANG['UsersMenu_vacation'] = 'Auto Response';
|
||||
$LANG['UsersMenu_edit_alias'] = 'Change your forward';
|
||||
$LANG['UsersMenu_password'] = 'Change Password';
|
||||
|
||||
$LANG['UsersVacation_welcome'] = 'Auto Response';
|
||||
$LANG['UsersVacation_welcome_text'] = 'You already have an auto response configured.';
|
||||
$LANG['UsersVacation_subject'] = 'Subject';
|
||||
$LANG['UsersVacation_subject_text'] = 'Out of Office';
|
||||
$LANG['UsersVacation_body'] = 'Body';
|
||||
$LANG['UsersVacation_body_text'] = <<<EOM
|
||||
$LANG['Vacation_welcome'] = 'Auto Response';
|
||||
$LANG['Vacation_welcome_text'] = 'Auto response is set.';
|
||||
$LANG['Vacation_subject'] = 'Subject';
|
||||
$LANG['Vacation_subject_text'] = 'Out of Office';
|
||||
$LANG['Vacation_body'] = 'Body';
|
||||
$LANG['Vacation_body_text'] = <<<EOM
|
||||
I will be away from <date> until <date>.
|
||||
For urgent matters you can contact <contact person>.
|
||||
EOM;
|
||||
$LANG['UsersVacation_button_away'] = 'Going Away';
|
||||
$LANG['UsersVacation_button_back'] = 'Coming Back';
|
||||
$LANG['UsersVacation_result_error'] = '<span class="error_msg">Unable to update your auto response settings.</span>';
|
||||
$LANG['UsersVacation_result_succes'] = 'Your auto response has been removed.';
|
||||
$LANG['Vacation_button_away'] = 'Going Away';
|
||||
$LANG['Vacation_button_back'] = 'Coming Back';
|
||||
$LANG['Vacation_result_error'] = '<span class="error_msg">Unable to update your auto response settings.</span>';
|
||||
$LANG['Vacation_result_succes'] = 'Your auto response has been removed.';
|
||||
|
||||
$LANG['Logging_alias_add'] = 'add alias';
|
||||
$LANG['Logging_alias_edit'] = 'edit alias';
|
||||
|
|
13
login.php
13
login.php
|
@ -32,6 +32,15 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
$sth->bindParam(1, $username, PDO::PARAM_STR);
|
||||
$sth->execute();
|
||||
$row = $sth->fetch(PDO::FETCH_ASSOC);
|
||||
if (empty($row)) {
|
||||
$sth = $dbh->prepare("SELECT password FROM mailbox WHERE username=?");
|
||||
$sth->bindParam(1, $username, PDO::PARAM_STR);
|
||||
$sth->execute();
|
||||
$row = $sth->fetch(PDO::FETCH_ASSOC);
|
||||
$location = "password.php";
|
||||
} else {
|
||||
$location = "list-domain.php";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($row['password'])) {
|
||||
|
@ -45,8 +54,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
if (empty($message)) {
|
||||
session_start();
|
||||
$_SESSION['sessid']['username'] = $username;
|
||||
$_SESSION['sessid']['role'] = $row['role'];
|
||||
header("Location: list-domain.php");
|
||||
$_SESSION['sessid']['role'] = $row['role'] ?? '';
|
||||
header("Location: $location");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
13
password.php
13
password.php
|
@ -24,7 +24,6 @@ include './languages/' . check_language() . '.lang';
|
|||
|
||||
$SESSID_USERNAME = check_session();
|
||||
$ROLE = check_role();
|
||||
$SESSID_USERNAME = $SESSID_USERNAME ?? ADMIN_EMAIL;
|
||||
|
||||
if ($ROLE == ADMIN_ROLE) {
|
||||
$list_domains = list_domains();
|
||||
|
@ -45,7 +44,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
|
||||
if (empty($message) && !empty($password_current)) {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("SELECT password FROM admin WHERE username=?");
|
||||
if (count($list_domains) == 0) {
|
||||
$sth = $dbh->prepare("SELECT password FROM mailbox WHERE username=?");
|
||||
} else {
|
||||
$sth = $dbh->prepare("SELECT password FROM admin WHERE username=?");
|
||||
}
|
||||
$sth->bindParam(1, $username, PDO::PARAM_STR);
|
||||
$sth->execute();
|
||||
$row = $sth->fetch(PDO::FETCH_COLUMN);
|
||||
|
@ -58,7 +61,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
$hashed = bcrypt($password1);
|
||||
try {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("UPDATE admin SET password=?,modified=NOW() WHERE username=?");
|
||||
if (count($list_domains) == 0) {
|
||||
$sth = $dbh->prepare("UPDATE mailbox SET password=?,modified=NOW() WHERE username=?");
|
||||
} else {
|
||||
$sth = $dbh->prepare("UPDATE admin SET password=?,modified=NOW() WHERE username=?");
|
||||
}
|
||||
$sth->bindParam(1, $hashed, PDO::PARAM_STR);
|
||||
$sth->bindParam(2, $username, PDO::PARAM_STR);
|
||||
$sth->execute();
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
<tr>
|
||||
<td colspan="2" class="standout"><?php echo $message ?? ' '; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><a href="users/"><?php echo $LANG['Login_login_users']; ?></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -1,20 +1,28 @@
|
|||
<div id="menu">
|
||||
<ul>
|
||||
<li><a target="_top" href="list-domain.php"><?php echo $LANG['Menu_list_domain']; ?></a></li>
|
||||
<li><a target="_top" href="list-virtual.php"><?php echo $LANG['Menu_list_virtual']; ?></a></li>
|
||||
|
||||
<?php if ($ROLE == ADMIN_ROLE) { ?>
|
||||
<li><a target="_top" href="list-admin.php"><?php echo $LANG['Menu_list_admin']; ?></a></li>
|
||||
<li><a target="_top" href="backup.php"><?php echo $LANG['Menu_backup']; ?></a></li>
|
||||
<li><a target="_top" href="domain.php"><?php echo $LANG['Menu_add_domain']; ?></a></li>
|
||||
<li><a target="_top" href="admin.php"><?php echo $LANG['Menu_add_admin']; ?></a></li>
|
||||
<?php if (count($list_domains) == 0) { ?>
|
||||
<li><a target="_top" href="password.php"><?php echo $LANG['Menu_user_password']; ?></a></li>
|
||||
<?php if (VACATION == "YES") { ?>
|
||||
<li><a target="_top" href="vacation.php"><?php echo $LANG['Menu_user_vacation']; ?></a></li>
|
||||
<?php } ?>
|
||||
<?php } else {?>
|
||||
<li><a target="_top" href="sendmail.php"><?php echo $LANG['Menu_sendmail']; ?></a></li>
|
||||
<li><a target="_top" href="password.php"><?php echo $LANG['Menu_password']; ?></a></li>
|
||||
|
||||
<li><a target="_top" href="list-domain.php"><?php echo $LANG['Menu_list_domain']; ?></a></li>
|
||||
<li><a target="_top" href="list-virtual.php"><?php echo $LANG['Menu_list_virtual']; ?></a></li>
|
||||
|
||||
<?php if ($ROLE == ADMIN_ROLE) { ?>
|
||||
<li><a target="_top" href="list-admin.php"><?php echo $LANG['Menu_list_admin']; ?></a></li>
|
||||
<li><a target="_top" href="backup.php"><?php echo $LANG['Menu_backup']; ?></a></li>
|
||||
<li><a target="_top" href="domain.php"><?php echo $LANG['Menu_add_domain']; ?></a></li>
|
||||
<li><a target="_top" href="admin.php"><?php echo $LANG['Menu_add_admin']; ?></a></li>
|
||||
<?php } else {?>
|
||||
<li><a target="_top" href="sendmail.php"><?php echo $LANG['Menu_sendmail']; ?></a></li>
|
||||
<li><a target="_top" href="password.php"><?php echo $LANG['Menu_password']; ?></a></li>
|
||||
<?php } ?>
|
||||
<li><a target="_top" href="add-alias.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_add_alias']; ?></a></li>
|
||||
<li><a target="_top" href="add-mailbox.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_add_mailbox']; ?></a></li>
|
||||
<li><a target="_top" href="viewlog.php"><?php echo $LANG['Menu_viewlog']; ?></a></li>
|
||||
<?php } ?>
|
||||
<li><a target="_top" href="add-alias.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_add_alias']; ?></a></li>
|
||||
<li><a target="_top" href="add-mailbox.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_add_mailbox']; ?></a></li>
|
||||
<li><a target="_top" href="viewlog.php"><?php echo $LANG['Menu_viewlog']; ?></a></li>
|
||||
<li><a target="_top" href="logout.php"><?php echo $LANG['Menu_logout']; ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<div id="edit_form">
|
||||
<form name="vacation" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="3"><h3><?php echo $LANG['Vacation_welcome']; ?></h3></td>
|
||||
</tr>
|
||||
<?php if ($action == 'away') { ?>
|
||||
<tr>
|
||||
<td><?php echo $LANG['Vacation_subject'] . ":"; ?></td>
|
||||
<td><input type="text" name="subject" value="<?php echo $LANG['Vacation_subject_text']; ?>" /></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $LANG['Vacation_body'] . ":"; ?></td>
|
||||
<td>
|
||||
<textarea rows="10" cols="80" name="body">
|
||||
<?php echo $LANG['Vacation_body_text']; ?>
|
||||
</textarea>
|
||||
</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="hlp_center"><input class="button" type="submit" name="away" value="<?php echo $LANG['Vacation_button_away']; ?>" /></td>
|
||||
<?php } else { ?>
|
||||
<td colspan="3" class="hlp_center"><input class="button" type="submit" name="back" value="<?php echo $LANG['Vacation_button_back']; ?>" /></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="standout"><?php echo $message ?? ' '; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
|
@ -13,7 +13,7 @@
|
|||
//
|
||||
// -none-
|
||||
//
|
||||
// Form POST / GET Variables:
|
||||
// POST / GET Variables:
|
||||
//
|
||||
// -none-
|
||||
//
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//
|
||||
// -none-
|
||||
//
|
||||
// Form POST / GET Variables:
|
||||
// POST / GET Variables:
|
||||
//
|
||||
// -none-
|
||||
//
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//
|
||||
// message
|
||||
//
|
||||
// Form POST / GET Variables:
|
||||
// POST / GET Variables:
|
||||
//
|
||||
// password_current
|
||||
// password1
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// tSubject
|
||||
// tBody
|
||||
//
|
||||
// Form POST / GET Variables:
|
||||
// POST / GET Variables:
|
||||
//
|
||||
// fSubject
|
||||
// fBody
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
//
|
||||
// OpenSMTPD Admin
|
||||
// by Mischa Peters <mischa at high5 dot nl>
|
||||
// Copyright (c) 2022 High5!
|
||||
// License Info: LICENSE.TXT
|
||||
//
|
||||
// File: vacation.php
|
||||
//
|
||||
// Template File: users_vacation.tpl
|
||||
//
|
||||
// Template Variables:
|
||||
//
|
||||
// tMessage
|
||||
// tSubject
|
||||
// tBody
|
||||
//
|
||||
// POST / GET Variables:
|
||||
//
|
||||
// fSubject
|
||||
// fBody
|
||||
//
|
||||
require_once './functions.inc.php';
|
||||
include './languages/' . check_language() . '.lang';
|
||||
|
||||
$SESSID_USERNAME = check_session();
|
||||
$ROLE = check_role();
|
||||
|
||||
if ($ROLE == ADMIN_ROLE) {
|
||||
$list_domains = list_domains();
|
||||
$list_admins = list_admins();
|
||||
} else {
|
||||
$list_domains = list_domains($SESSID_USERNAME);
|
||||
}
|
||||
|
||||
$USERID_DOMAIN = substr(strrchr($SESSID_USERNAME, "@"), 1);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("SELECT COUNT(*) FROM vacation WHERE email=?");
|
||||
$sth->execute(array($SESSID_USERNAME));
|
||||
|
||||
if ($sth->fetchColumn() == 1) {
|
||||
$action = 'back';
|
||||
$message = $LANG['Vacation_welcome_text'];
|
||||
} else {
|
||||
$action = 'away';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
$subject = filter_input(INPUT_POST, 'subject', FILTER_DEFAULT);
|
||||
$body = filter_input(INPUT_POST, 'body', FILTER_DEFAULT);
|
||||
|
||||
if (!empty($_POST['back'])) {
|
||||
$action = 'back';
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("DELETE FROM vacation WHERE email=?");
|
||||
$sth->bindParam(1, $SESSID_USERNAME, PDO::PARAM_STR);
|
||||
$sth->execute();
|
||||
if ($sth->rowCount() != 1) {
|
||||
$message = $LANG['Vacation_result_error'];
|
||||
} else {
|
||||
$action = 'away';
|
||||
$essage = $LANG['Vacation_result_succes'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_POST['away'])) {
|
||||
$action = 'away';
|
||||
try {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("INSERT INTO vacation (email,subject,body,cache,domain,created) VALUES (?,?,?,'',?,NOW())");
|
||||
$sth->bindParam(1, $SESSID_USERNAME, PDO::PARAM_STR);
|
||||
$sth->bindParam(2, $subject, PDO::PARAM_STR);
|
||||
$sth->bindParam(3, $body, PDO::PARAM_STR);
|
||||
$sth->bindParam(4, $USERID_DOMAIN, PDO::PARAM_STR);
|
||||
$sth->execute();
|
||||
header("Location: vacation.php");
|
||||
} catch(PDOException $e) {
|
||||
$message = $LANG['Vacation_result_error'] . " " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
include './templates/header.tpl';
|
||||
include './templates/menu.tpl';
|
||||
include './templates/vacation.tpl';
|
||||
include './templates/footer.tpl';
|
||||
?>
|
Loading…
Reference in New Issue