fixed error checking additional properties of users
This commit is contained in:
parent
e6ef6ac019
commit
bf4c8b0bad
|
@ -2,7 +2,7 @@
|
||||||
"name": "alfnru/password_recovery",
|
"name": "alfnru/password_recovery",
|
||||||
"type": "roundcube-plugin",
|
"type": "roundcube-plugin",
|
||||||
"description": "Plugin that adds functionality so that a user can create a new password if the original is lost.",
|
"description": "Plugin that adds functionality so that a user can create a new password if the original is lost.",
|
||||||
"version": "1.1",
|
"version": "1.2",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"homepage": "https://github.com/AlfnRU/roundcube-password_recovery/",
|
"homepage": "https://github.com/AlfnRU/roundcube-password_recovery/",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
|
@ -58,12 +58,21 @@ class password_recovery extends rcube_plugin {
|
||||||
|
|
||||||
$this->use_password = ($this->rc->config->get('pr_use_password_plugin') && $this->rc->plugins->load_plugin('password', true));
|
$this->use_password = ($this->rc->config->get('pr_use_password_plugin') && $this->rc->plugins->load_plugin('password', true));
|
||||||
|
|
||||||
foreach($this->fields as $field => $field_name){
|
$new_fields = [
|
||||||
|
'email_other' => ['type' => 'VARCHAR(255)', 'default' => ''],
|
||||||
|
'phone' => ['type' => 'VARCHAR(30)' , 'default' => ''],
|
||||||
|
'question' => ['type' => 'VARCHAR(255)', 'default' => ''],
|
||||||
|
'answer' => ['type' => 'VARCHAR(255)', 'default' => ''],
|
||||||
|
'token' => ['type' => 'VARCHAR(255)', 'default' => ''],
|
||||||
|
'token_validity' => ['type' => 'DATETIME' , 'default' => '2000-01-01 00:00:00']
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach($new_fields as $field_name => $field_props){
|
||||||
$query = "SELECT " . $field_name . " FROM " . $this->rc->config->get('pr_users_table');
|
$query = "SELECT " . $field_name . " FROM " . $this->rc->config->get('pr_users_table');
|
||||||
$result = $this->db->query($query);
|
$result = $this->db->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$type = ($field == 'phone' ? 'VARCHAR(30)' : 'VARCHAR(255)');
|
$type = ($field == 'phone' ? 'VARCHAR(30)' : 'VARCHAR(255)');
|
||||||
$query = "ALTER TABLE " . $this->rc->config->get('pr_users_table') . " ADD " . $field_name . " " . $type . " CHARACTER SET utf8 NOT NULL";
|
$query = "ALTER TABLE " . $this->rc->config->get('pr_users_table') . " ADD " . $field_name . " " . $field_props['type'] . " DEFAULT " . $field_props['default'] . " CHARACTER SET utf8 NOT NULL";
|
||||||
$result = $this->db->query($query);
|
$result = $this->db->query($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue