Commit d4c760c1 authored by mcramer's avatar mcramer

Implemented optional custom login name for mailboxes.

parent 03b74b91
......@@ -103,7 +103,7 @@ MYSQL_GID_FIELD 8
# SELECT MYSQL_UID_FIELD, MYSQL_GID_FIELD, ... WHERE id='loginid'
#
MYSQL_LOGIN_FIELD email
MYSQL_LOGIN_FIELD login
##NAME: MYSQL_HOME_FIELD:0
#
......
......@@ -589,6 +589,7 @@ CREATE TABLE `mail_user` (
`sys_perm_other` varchar(5) NOT NULL default '',
`server_id` int(11) unsigned NOT NULL default '0',
`email` varchar(255) NOT NULL default '',
`login` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL default '',
`uid` int(11) unsigned NOT NULL default '5000',
......
......@@ -8,7 +8,7 @@ MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD uid
MYSQL_GID_FIELD gid
MYSQL_LOGIN_FIELD email
MYSQL_LOGIN_FIELD login
MYSQL_HOME_FIELD homedir
MYSQL_MAILDIR_FIELD maildir
#MYSQL_NAME_FIELD
......
......@@ -120,7 +120,7 @@ driver = mysql
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password}
default_pass_scheme = CRYPT
password_query = SELECT password FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
#user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
user_query = SELECT email AS user, maildir AS home, CONCAT('*:storage=', quota , 'B') AS quota_rule FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
password_query = SELECT password FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
#user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
user_query = SELECT email AS user, maildir AS home, CONCAT('*:storage=', quota , 'B') AS quota_rule FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
......@@ -120,7 +120,7 @@ driver = mysql
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password}
default_pass_scheme = CRYPT
password_query = SELECT password FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
password_query = SELECT password FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
......@@ -133,5 +133,5 @@ driver = mysql
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password}
default_pass_scheme = CRYPT
password_query = SELECT password FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
password_query = SELECT password FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
......@@ -3,6 +3,6 @@ password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
where_field = email
where_field = login
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
......@@ -133,5 +133,5 @@ driver = mysql
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password}
default_pass_scheme = CRYPT
password_query = SELECT password FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
password_query = SELECT password FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
auth required pam_mysql.so user={mysql_server_ispconfig_user} passwd={mysql_server_ispconfig_password} host={mysql_server_ip} db={mysql_server_database} table=mail_user usercolumn=email passwdcolumn=password crypt=1
account sufficient pam_mysql.so user={mysql_server_ispconfig_user} passwd={mysql_server_ispconfig_password} host={mysql_server_ip} db={mysql_server_database} table=mail_user usercolumn=email passwdcolumn=password crypt=1
\ No newline at end of file
auth required pam_mysql.so user={mysql_server_ispconfig_user} passwd={mysql_server_ispconfig_password} host={mysql_server_ip} db={mysql_server_database} table=mail_user usercolumn=login passwdcolumn=password crypt=1
account sufficient pam_mysql.so user={mysql_server_ispconfig_user} passwd={mysql_server_ispconfig_password} host={mysql_server_ip} db={mysql_server_database} table=mail_user usercolumn=login passwdcolumn=password crypt=1
\ No newline at end of file
......@@ -6,4 +6,4 @@ sql_hostnames: {mysql_server_ip}
sql_user: {mysql_server_ispconfig_user}
sql_passwd: {mysql_server_ispconfig_password}
sql_database: {mysql_server_database}
sql_select: select password from mail_user where email = '%u'
\ No newline at end of file
sql_select: select password from mail_user where login = '%u'
......@@ -7,6 +7,7 @@
[dns]
[mail]
enable_custom_login=n
mailboxlist_webmail_link=y
webmail_url=
......
......@@ -162,6 +162,12 @@ $form["tabs"]['mail'] = array (
##################################
# Begin Datatable fields
##################################
'enable_custom_login' => array(
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'mailboxlist_webmail_link' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
......
......@@ -19,4 +19,5 @@ $wb['use_domain_module_txt'] = 'Use the domain-module to add new domains';
$wb['use_domain_module_hint'] = 'If you use this module, your customers can only select one of the domains the admin creates for them. They cannot free edit the domain-field.You have to re-login after changing this value, to make the changes visible.';
$wb['new_domain_txt'] = 'HTML to create a new domain';
$wb['webftp_url_txt'] = 'WebFTP URL';
$wb['enable_custom_login_txt'] = 'Abweichenden Login-Namen erlauben';
?>
......@@ -12,6 +12,7 @@ $wb["ftpuser_prefix_error_regex"] = 'Char not allowed in ftp user prefix.';
$wb["shelluser_prefix_error_regex"] = 'Char not allowed in shell user prefix.';
$wb["webdavuser_prefix_error_regex"] = 'Char not allowed in webdav user prefix.';
$wb["dblist_phpmyadmin_link_txt"] = 'Link to phpmyadmin in DB list';
$wb['enable_custom_login_txt'] = 'Allow custom login name';
$wb["mailboxlist_webmail_link_txt"] = 'Link to webmail in Mailbox list';
$wb["webmail_url_txt"] = 'Webmail URL';
$wb["mailmailinglist_link_txt"] = 'Link to mailing list in Mailing list list';
......@@ -21,7 +22,7 @@ $wb["use_domain_module_txt"] = 'Use the domain-module to add new domains';
$wb["use_domain_module_hint"] = 'If you use this module, your customers can only select one of the domains the admin creates for them. They cannot free edit the domain-field.You have to re-login after changing this value, to make the changes visible.';
$wb["new_domain_txt"] = 'HTML to create a new domain';
$wb["webftp_url_txt"] = 'WebFTP URL';
$wb['admin_mail_txt'] = 'Administrator\'s e-mail';
$wb["monitor_key_txt"] = 'Monitor keyword';
$wb['admin_name_txt'] = 'Administrator\'s name';
$wb['admin_mail_txt'] = 'Administrator\'s e-mail';
$wb["monitor_key_txt"] = 'Monitor keyword';
$wb['admin_name_txt'] = 'Administrator\'s name';
?>
......@@ -68,9 +68,9 @@
<input name="mailbox_size_limit" id="mailbox_size_limit" value="{tmpl_var name='mailbox_size_limit'}" size="10" maxlength="15" type="text" class="textInput formLengthLimit" />&nbsp;MB
</div>
<div class="ctrlHolder">
<label for="message_size_limit">{tmpl_var name='message_size_limit_txt'}</label>
<label for="message_size_limit">{tmpl_var name='message_size_limit_txt'}</label>
<input name="message_size_limit" id="message_size_limit" value="{tmpl_var name='message_size_limit'}" size="10" maxlength="15" type="text" class="textInput formLengthLimit" />&nbsp;MB
</div>
</div>
</fieldset>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
......
......@@ -5,6 +5,12 @@
<div class="pnl_formsarea">
<fieldset class="inlineLabels">
<div class="ctrlHolder">
<p class="label">{tmpl_var name='enable_custom_login_txt'}</p>
<div class="multiField">
{tmpl_var name='enable_custom_login'}
</div>
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='mailboxlist_webmail_link_txt'}</p>
<div class="multiField">
......
......@@ -79,6 +79,21 @@ $form["tabs"]['mailuser'] = array (
'width' => '30',
'maxlength' => '255'
),
'login' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array (
0 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'login_error_unique'),
1 => array ( 'type' => 'REGEX',
'regex' => '/^[a-z][\w\.\-_\+@]{1,63}$/',
'errmsg'=> 'login_error_regex'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'password' => array (
'datatype' => 'VARCHAR',
'formtype' => 'PASSWORD',
......
......@@ -39,4 +39,8 @@ $wb['name_optional_txt'] = '(optional)';
$wb['autoresponder_active'] = 'Enable the autoresponder';
$wb['cc_txt'] = 'Send copy to';
$wb['cc_error_isemail'] = 'The Send copy to field does not conatin a valid email address';
$wb['login_error_unique'] = 'Login wird bereits verwendet.';
$wb['login_error_regex'] = 'Zulässige Zeichen sind A-Z, a-z, 0-9, ., _ und -.';
$wb['login_txt'] = 'Login (optional)';
$wb['error_login_email_txt'] = 'Dieser Loginname ist nicht zulässig. Bitte verwenden Sie einen anderen Loginnamen oder die E-Mail-Adresse als Login.';
?>
......@@ -4,4 +4,5 @@ $wb['email_txt'] = 'E-Mail-Adresse';
$wb['autoresponder_txt'] = 'Autoresponder';
$wb['add_new_record_txt'] = 'Neue Mailbox hinzufügen';
$wb['name_txt'] = 'Realname';
$wb['login_txt'] = 'Login';
?>
......@@ -41,4 +41,8 @@ $wb['cc_txt'] = 'Send copy to';
$wb['cc_error_isemail'] = 'The -Send copy to- field does not conatin a valid email address';
$wb['domain_txt'] = 'Domain';
$wb['now_txt']='Now';
$wb['login_error_unique'] = 'Login is already taken.';
$wb['login_error_regex'] = 'Valid characters are A-Z, a-z, 0-9, ., _ and -.';
$wb['login_txt'] = 'Login (optional)';
$wb['error_login_email_txt'] = 'This login is not allowed. Please enter a different login or use the mail address as login.';
?>
......@@ -4,4 +4,5 @@ $wb["email_txt"] = 'Email';
$wb["autoresponder_txt"] = 'Autoresponder';
$wb["add_new_record_txt"] = 'Add new Mailbox';
$wb["name_txt"] = 'Realname';
$wb["login_txt"] = 'Login';
?>
\ No newline at end of file
......@@ -47,14 +47,23 @@ $liste["auth"] = "yes";
* Suchfelder
*****************************************************/
$liste["item"][] = array( 'field' => "email",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "email",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "login",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "name",
'datatype' => "VARCHAR",
......
......@@ -75,7 +75,7 @@ class page_action extends tform_actions {
$app->tpl->setVar("email_local_part",$email_parts[0]);
// Getting Domains of the user
$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
$sql = "SELECT domain, server_id FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
$domains = $app->db->queryAllRecords($sql);
$domain_select = '';
if(is_array($domains)) {
......@@ -114,6 +114,14 @@ class page_action extends tform_actions {
$app->tpl->setVar("ar_active", '');
}
$app->uses('getconf');
$mail_config = $app->getconf->get_global_config('mail');
if($mail_config["enable_custom_login"] == "y") {
$app->tpl->setVar("enable_custom_login", 1);
} else {
$app->tpl->setVar("enable_custom_login", 0);
}
parent::onShowEnd();
}
......@@ -165,6 +173,9 @@ class page_action extends tform_actions {
} // end if user is not admin
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($domain["server_id"],'mail');
//* compose the email field
if(isset($_POST["email_local_part"]) && isset($_POST["email_domain"])) {
$this->dataRecord["email"] = strtolower($_POST["email_local_part"]."@".$_POST["email_domain"]);
......@@ -179,8 +190,6 @@ class page_action extends tform_actions {
if($this->dataRecord["quota"] != -1) $this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024 * 1024;
// setting Maildir, Homedir, UID and GID
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($domain["server_id"],'mail');
$maildir = str_replace("[domain]",$domain["domain"],$mail_config["maildir_path"]);
$maildir = str_replace("[localpart]",strtolower($_POST["email_local_part"]),$maildir);
$this->dataRecord["maildir"] = $maildir;
......@@ -195,6 +204,13 @@ class page_action extends tform_actions {
}
$sys_config = $app->getconf->get_global_config('mail');
if($sys_config["enable_custom_login"] == "y") {
if(!isset($_POST["login"])) $this->dataRecord["login"] = $this->dataRecord["email"];
elseif(strpos($_POST["login"], '@') !== false && $_POST["login"] != $this->dataRecord["email"]) $app->tform->errorMessage .= $app->tform->lng("error_login_email_txt")."<br>";
} else {
$this->dataRecord["login"] = $this->dataRecord["email"];
}
//* if autoresponder checkbox not selected, do not save dates
if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_start_date']);
......
......@@ -31,6 +31,12 @@ class list_action extends listform_actions {
} else {
$app->tpl->setVar('mailboxlist_webmail_link',0);
}
if($global_config["enable_custom_login"] == "y") {
$app->tpl->setVar("enable_custom_login", 1);
} else {
$app->tpl->setVar("enable_custom_login", 0);
}
parent::onShow();
}
......
......@@ -19,13 +19,15 @@
<thead>
<tr>
<th class="tbl_col_email" scope="col"><tmpl_var name="email_txt"></th>
<th class="tbl_col_name" scope="col"><tmpl_var name="name_txt"></th>
<tmpl_if name="enable_custom_login"><th class="tbl_col_login" scope="col"><tmpl_var name="login_txt"></th></tmpl_if>
<th class="tbl_col_name" scope="col"><tmpl_var name="name_txt"></th>
<th class="tbl_col_autoresponder" scope="col"><tmpl_var name="autoresponder_txt"></th>
<th class="tbl_col_buttons" scope="col">&nbsp;</th>
</tr>
<tr>
<td class="tbl_col_email"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" /></td>
<td class="tbl_col_name"><input type="text" name="search_name" value="{tmpl_var name='search_name'}" /></td>
<tmpl_if name="enable_custom_login"><td class="tbl_col_login"><input type="text" name="search_login" value="{tmpl_var name='search_login'}" /></td></tmpl_if>
<td class="tbl_col_autoresponder"><input type="text" name="search_autoresponder" value="{tmpl_var name='search_autoresponder'}" /></td>
<td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','mail/mail_user_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
</tr>
......@@ -34,6 +36,7 @@
<tmpl_loop name="records">
<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
<td class="tbl_col_email"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="email"}</a></td>
<tmpl_if name="enable_custom_login"><td class="tbl_col_login"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="login"}</a></td></tmpl_if>
<td class="tbl_col_name"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="name"}</a></td>
<td class="tbl_col_autoresponder"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="autoresponder"}</a></td>
<td class="tbl_col_buttons">
......@@ -48,7 +51,7 @@
<tfoot>
<tr>
<td class="tbl_footer tbl_paging" colspan="4"><tmpl_var name="paging"></td>
<td class="tbl_footer tbl_paging" colspan="<tmpl_if name="enable_custom_login">5<tmpl_else>4</tmpl_if>"><tmpl_var name="paging"></td>
</tr>
</tfoot>
</table>
......
......@@ -17,6 +17,10 @@
<label for="email_domain" class="blockLabel formLengthEmailDomain">{tmpl_var name='domain_txt'}<select name="email_domain" id="email_domain" class="selectInput">{tmpl_var name='email_domain'}</select></label>
</div>
</div>
<tmpl_if name="enable_custom_login"><div class="ctrlHolder">
<label for="login">{tmpl_var name='login_txt'}</label>
<input type="text" id="login" name="login" size="20" value="{tmpl_var name='login'}" class="textInput" /></label>
</div></tmpl_if>
<div class="ctrlHolder">
<label for="password">{tmpl_var name='password_txt'}</label>
<input name="password" id="password" value="{tmpl_var name='password'}" size="30" maxlength="255" type="password" class="textInput" onkeyup="pass_check(this.value)" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment