diff --git a/config.inc.php b/config.inc.php index f236385e..c35f47ac 100644 --- a/config.inc.php +++ b/config.inc.php @@ -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'] = ''; /* diff --git a/model/AdminHandler.php b/model/AdminHandler.php index 585e4c16..db559a17 100644 --- a/model/AdminHandler.php +++ b/model/AdminHandler.php @@ -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())), diff --git a/model/MailboxHandler.php b/model/MailboxHandler.php index dd58809c..b073b38f 100644 --- a/model/MailboxHandler.php +++ b/model/MailboxHandler.php @@ -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())),