possibility to specify sender address for froxlor as the admin-email address, custom or empty for system-default; fixes #1217
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -99,7 +99,7 @@ class Install
|
||||
}
|
||||
|
||||
// check for url manipulation or wrong step
|
||||
if ((isset($_SESSION['installation']['stepCompleted']) && ($this->currentStep + 1) > $_SESSION['installation']['stepCompleted'])
|
||||
if ((isset($_SESSION['installation']['stepCompleted']) && $this->currentStep > $_SESSION['installation']['stepCompleted'])
|
||||
|| (!isset($_SESSION['installation']['stepCompleted']) && $this->currentStep > 0)
|
||||
) {
|
||||
$this->currentStep = isset($_SESSION['installation']['stepCompleted']) ? $_SESSION['installation']['stepCompleted'] + 1 : 1;
|
||||
@@ -322,6 +322,8 @@ class Install
|
||||
$email = $validatedData['admin_email'] ?? '';
|
||||
$password = $validatedData['admin_pass'] ?? '';
|
||||
$password_confirm = $validatedData['admin_pass_confirm'] ?? '';
|
||||
$useadminmailassender = $validatedData['use_admin_email_as_sender'] ?? '1';
|
||||
$senderemail = $validatedData['sender_email'] ?? '';
|
||||
|
||||
if (!preg_match('/^[^\r\n\t\f\0]*$/D', $name)) {
|
||||
throw new Exception(lng('error.stringformaterror', ['admin_name']));
|
||||
@@ -329,6 +331,8 @@ class Install
|
||||
throw new Exception(lng('error.loginnameiswrong', [$loginname]));
|
||||
} elseif (empty(trim($email)) || !Validate::validateEmail($email)) {
|
||||
throw new Exception(lng('error.emailiswrong', [$email]));
|
||||
} elseif ((int)$useadminmailassender == 0 && !empty(trim($senderemail)) && !Validate::validateEmail($senderemail)) {
|
||||
throw new Exception(lng('error.emailiswrong', [$senderemail]));
|
||||
} elseif (empty($password) || $password != $password_confirm) {
|
||||
throw new Exception(lng('error.newpasswordconfirmerror'));
|
||||
} elseif ($password == $loginname) {
|
||||
|
||||
@@ -365,7 +365,14 @@ class Core
|
||||
|
||||
$mainip = !empty($this->validatedData['serveripv6']) ? $this->validatedData['serveripv6'] : $this->validatedData['serveripv4'];
|
||||
|
||||
$this->updateSetting($upd_stmt, 'admin@' . $this->validatedData['servername'], 'panel', 'adminmail');
|
||||
if ($this->validatedData['use_admin_email_as_sender'] == '1') {
|
||||
$adminmail_value = $this->validatedData['admin_email'];
|
||||
} elseif ($this->validatedData['use_admin_email_as_sender'] == '0' && !empty($this->validatedData['sender_email'])) {
|
||||
$adminmail_value = $this->validatedData['sender_email'];
|
||||
} else {
|
||||
$adminmail_value = 'admin@' . $this->validatedData['servername'];
|
||||
}
|
||||
$this->updateSetting($upd_stmt, $adminmail_value, 'panel', 'adminmail');
|
||||
$this->updateSetting($upd_stmt, $mainip, 'system', 'ipaddress');
|
||||
if ($this->validatedData['use_ssl']) {
|
||||
$this->updateSetting($upd_stmt, 1, 'system', 'use_ssl');
|
||||
@@ -563,7 +570,7 @@ class Core
|
||||
'password' => password_hash($this->validatedData['admin_pass'], PASSWORD_DEFAULT),
|
||||
'adminname' => $this->validatedData['admin_name'],
|
||||
'email' => $this->validatedData['admin_email'],
|
||||
'deflang' => 'en' // TODO: set lanuage
|
||||
'deflang' => 'en' // TODO: set language
|
||||
];
|
||||
$ins_stmt = $db_user->prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_ADMINS . "` SET
|
||||
|
||||
Reference in New Issue
Block a user