aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/template/goto/user_list.tpl10
-rw-r--r--admin/user_list.php68
-rw-r--r--include/config_default.inc.php3
3 files changed, 59 insertions, 22 deletions
diff --git a/admin/template/goto/user_list.tpl b/admin/template/goto/user_list.tpl
index 4d4fc2cc7..e1ed3c2bc 100644
--- a/admin/template/goto/user_list.tpl
+++ b/admin/template/goto/user_list.tpl
@@ -7,9 +7,13 @@
<fieldset>
<legend>{'Add a user'|@translate}</legend>
<label>{'Username'|@translate} <input type="text" name="login" maxlength="50" size="20"></label>
- <label>{'Password'|@translate} <input type="password" name="password"></label>
- <label>{'Confirm Password'|@translate} <input type="password" name="password_conf" id="password_conf"></label>
- <label>{'Email address'|@translate} <input type="text" name="email"></label>
+ {if $Double_Password}
+ <label>{'Password'|@translate} <input type="password" name="password"></label>
+ <label>{'Confirm Password'|@translate} <input type="password" name="password_conf" id="password_conf"></label>
+ {else}
+ <label>{'Password'|@translate} <input type="text" name="password"></label>
+ {/if}
+ <label>{'Email address'|@translate} <input type="text" name="email"></label>
<label>&nbsp; <input class="submit" type="submit" name="submit_add" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED}></label>
</fieldset>
</form>
diff --git a/admin/user_list.php b/admin/user_list.php
index c7e36ae0b..daac95a8e 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -183,30 +183,34 @@ $page['direction_items'] = array(
// | add a user |
// +-----------------------------------------------------------------------+
-if (isset($_POST['submit_add']))
+// Check for config_default var - If True : Using double password type else single password type
+// This feature is discussed on Piwigo's english forum
+if ($conf['double_password_type_in_admin'] == true)
{
- if(empty($_POST['password']))
- {
- array_push($page['errors'], l10n('Password is missing'));
- }
- else if(empty($_POST['password_conf']))
- {
- array_push($page['errors'], l10n('Password confirmation is missing'));
- }
- else if(empty($_POST['email']))
- {
- array_push($page['errors'], l10n('Email address is missing'));
- }
- else if ($_POST['password'] != $_POST['password_conf'])
- {
- array_push($page['errors'], l10n('Password confirmation error'));
- }
- else
+ if (isset($_POST['submit_add']))
{
+ if(empty($_POST['password']))
+ {
+ array_push($page['errors'], l10n('Password is missing'));
+ }
+ else if(empty($_POST['password_conf']))
+ {
+ array_push($page['errors'], l10n('Password confirmation is missing'));
+ }
+ else if(empty($_POST['email']))
+ {
+ array_push($page['errors'], l10n('Email address is missing'));
+ }
+ else if ($_POST['password'] != $_POST['password_conf'])
+ {
+ array_push($page['errors'], l10n('Password confirmation error'));
+ }
+ else
+ {
$page['errors'] = register_user(
$_POST['login'], $_POST['password'], $_POST['email'], false);
- if (count($page['errors']) == 0)
+ if (count($page['errors']) == 0)
{
array_push(
$page['infos'],
@@ -216,8 +220,28 @@ if (isset($_POST['submit_add']))
)
);
}
+ }
}
}
+else if ($conf['double_password_type_in_admin'] == false)
+{
+ if (isset($_POST['submit_add']))
+ {
+ $page['errors'] = register_user(
+ $_POST['login'], $_POST['password'], $_POST['email'], false);
+
+ if (count($page['errors']) == 0)
+ {
+ array_push(
+ $page['infos'],
+ sprintf(
+ l10n('user "%s" added'),
+ $_POST['login']
+ )
+ );
+ }
+ }
+}
// +-----------------------------------------------------------------------+
// | user list |
@@ -505,6 +529,12 @@ if ($conf['allow_adviser'])
$template->assign('adviser', true);
}
+// Display or Hide double password type
+if ($conf['double_password_type_in_admin'])
+{
+ $template->assign('Double_Password', true);
+}
+
// Filter status options
$status_options[-1] = '------------';
foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index 7ad3b6d86..23e1c8b85 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -317,6 +317,9 @@ $conf['rate_items'] = array(0,1,2,3,4,5);
// Define default method to use ('http' or 'html' in order to do redirect)
$conf['default_redirect_method'] = 'http';
+// Define using double password type in admin's users management panel
+$conf['double_password_type_in_admin'] = false;
+
// +-----------------------------------------------------------------------+
// | metadata |
// +-----------------------------------------------------------------------+