[Bug 1041] Switchable double/single password input with text or password type in admin using new $conf

git-svn-id: http://piwigo.org/svn/trunk@3935 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
Eric 2009-09-28 19:22:59 +00:00
commit d67b276519
3 changed files with 59 additions and 22 deletions

View file

@ -7,8 +7,12 @@
<fieldset>
<legend>{'Add a user'|@translate}</legend>
<label>{'Username'|@translate} <input type="text" name="login" maxlength="50" size="20"></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>

View file

@ -183,8 +183,12 @@ $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 (isset($_POST['submit_add']))
{
if(empty($_POST['password']))
{
array_push($page['errors'], l10n('Password is missing'));
@ -217,6 +221,26 @@ 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']
)
);
}
}
}
// +-----------------------------------------------------------------------+
@ -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)

View file

@ -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 |
// +-----------------------------------------------------------------------+