add vhost shell auth option for vmail login
This commit is contained in:
parent
b89907c455
commit
64353c2f67
|
@ -44,6 +44,18 @@ class Login extends \Panel {
|
||||||
if ($f3->get('NAV.mapping') == 'vmail') {
|
if ($f3->get('NAV.mapping') == 'vmail') {
|
||||||
/* enforce email address format for username */
|
/* enforce email address format for username */
|
||||||
if (! strstr($username, '@')) {
|
if (! strstr($username, '@')) {
|
||||||
|
/* username not in email format, check if username matches vhost username */
|
||||||
|
if ($vhost_array = $f3->call('\Panel::vGet', array("vhost-get.sh -d $domain -u $username -c", FALSE))) {
|
||||||
|
if (count($vhost_array) == '1') {
|
||||||
|
/* got a match with vhost username, check if password validates for shell username */
|
||||||
|
exec("/usr/bin/echo -e '$username\\n$password\\n' | /usr/sbin/pwauth", $output, $result_code);
|
||||||
|
if ($result_code == 0) {
|
||||||
|
$f3->set('SESSION.expiration', time() + $f3->get('TIMEOUT'));
|
||||||
|
$f3->reroute('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* shell auth didn't validate for one reason or another, turn username into email and try that */
|
||||||
$username = "$username@$domain";
|
$username = "$username@$domain";
|
||||||
}
|
}
|
||||||
$emaildomain = $f3->get('HOST');
|
$emaildomain = $f3->get('HOST');
|
||||||
|
@ -56,9 +68,6 @@ class Login extends \Panel {
|
||||||
$messages[] = "Please log in with an admin account.";
|
$messages[] = "Please log in with an admin account.";
|
||||||
$f3->set('SESSION.messages', $messages);
|
$f3->set('SESSION.messages', $messages);
|
||||||
echo \Template::instance()->render('login.html');
|
echo \Template::instance()->render('login.html');
|
||||||
// $f3->set('SESSION.expiration', time() + $f3->get('TIMEOUT'));
|
|
||||||
// $f3->set('SESSION.access', 'user');
|
|
||||||
// $f3->reroute('/');
|
|
||||||
} elseif ($email_array[0]['status'] == '2') {
|
} elseif ($email_array[0]['status'] == '2') {
|
||||||
$f3->set('SESSION.expiration', time() + $f3->get('TIMEOUT'));
|
$f3->set('SESSION.expiration', time() + $f3->get('TIMEOUT'));
|
||||||
$f3->set('SESSION.access', 'admin');
|
$f3->set('SESSION.access', 'admin');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user