mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
display phone number field only if $CONF[sms_send_function] is set
Without a way to send a SMS, asking users for their mobile number is pointless.
This commit is contained in:
parent
cdf3c9acb9
commit
3f1866d041
@ -600,6 +600,8 @@ $CONF['forgotten_admin_password_reset'] = false;
|
||||
// Please use a name that begins with "x_" to prevent collisions
|
||||
// This function must accept 2 parameters: phone number and message,
|
||||
// and return true on success or false on failure
|
||||
// Note: if no sms_send_function is defined, the input field for the mobile
|
||||
// number won't be displayed
|
||||
$CONF['sms_send_function'] = '';
|
||||
|
||||
/*
|
||||
|
@ -36,6 +36,13 @@ class AdminHandler extends PFAHandler {
|
||||
|
||||
$passwordReset = Config::read('forgotten_admin_password_reset');
|
||||
|
||||
if ($passwordReset) {
|
||||
$reset_by_sms = 0;
|
||||
if (Config::read('sms_send_function')) {
|
||||
$reset_by_sms = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->struct=array(
|
||||
# field name allow display in... type $PALANG label $PALANG description default / options / ...
|
||||
# editing? form list
|
||||
@ -75,7 +82,7 @@ class AdminHandler extends PFAHandler {
|
||||
' ) AS __domain on username = __domain_username'),
|
||||
|
||||
'active' => pacol(1, 1, 1, 'bool', 'active' , '' , 1 ),
|
||||
'phone' => pacol(1, $passwordReset, 0, 'text', 'pCreate_mailbox_phone', 'pCreate_mailbox_phone_desc', ''),
|
||||
'phone' => pacol(1, $reset_by_sms, 0, 'text', 'pCreate_mailbox_phone', 'pCreate_mailbox_phone_desc', ''),
|
||||
'email_other' => pacol(1, $passwordReset, 0, 'mail', 'pCreate_mailbox_email', 'pCreate_mailbox_email_desc', ''),
|
||||
'token' => pacol(1, 0, 0, 'text', '' , '' ),
|
||||
'token_validity' => pacol(1, 0, 0, 'ts', '' , '', date("Y-m-d H:i:s",time())),
|
||||
|
@ -13,6 +13,13 @@ class MailboxHandler extends PFAHandler {
|
||||
# init $this->struct, $this->db_table and $this->id_field
|
||||
protected function initStruct() {
|
||||
$passwordReset = Config::read('forgotten_user_password_reset');
|
||||
if ($passwordReset) {
|
||||
$reset_by_sms = 0;
|
||||
if (Config::read('sms_send_function')) {
|
||||
$reset_by_sms = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->struct=array(
|
||||
# field name allow display in... type $PALANG label $PALANG description default / options / ...
|
||||
# editing? form list
|
||||
@ -38,7 +45,7 @@ class MailboxHandler extends PFAHandler {
|
||||
'welcome_mail' => pacol($this->new, $this->new, 0, 'bool', 'pCreate_mailbox_mail' , '' , 1,
|
||||
/*options*/ '',
|
||||
/*not_in_db*/ 1 ),
|
||||
'phone' => pacol(1, $passwordReset, 0, 'text', 'pCreate_mailbox_phone' , 'pCreate_mailbox_phone_desc' , ''),
|
||||
'phone' => pacol(1, $reset_by_sms, 0, 'text', 'pCreate_mailbox_phone' , 'pCreate_mailbox_phone_desc' , ''),
|
||||
'email_other' => pacol(1, $passwordReset, 0, 'mail', 'pCreate_mailbox_email' , 'pCreate_mailbox_email_desc' , ''),
|
||||
'token' => pacol(1, 0, 0, 'text', '' , '' ),
|
||||
'token_validity' => pacol(1, 0, 0, 'ts', '' , '', date("Y-m-d H:i:s",time())),
|
||||
|
Loading…
Reference in New Issue
Block a user