mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
feature:2517 ability to change username. admins can change usernames, users are notified by mail
git-svn-id: http://piwigo.org/svn/trunk@12882 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -5,24 +5,22 @@
|
||||
<input type="hidden" name="redirect" value="{$REDIRECT}">
|
||||
<ul>
|
||||
<li>
|
||||
<span class="property">{'Username'|@translate}</span>
|
||||
<span class="property">
|
||||
<label for="username">{'Username'|@translate}</label>
|
||||
</span>
|
||||
{if not $SPECIAL_USER}
|
||||
<input type="text" name="username" id="username" value="{$USERNAME}">
|
||||
{else}
|
||||
{$USERNAME}
|
||||
{/if}
|
||||
</li>
|
||||
{if not $SPECIAL_USER} {* can modify password + email*}
|
||||
{if not $SPECIAL_USER} {* can modify password + email*}
|
||||
<li>
|
||||
<span class="property">
|
||||
<label for="mail_address">{'Email address'|@translate}</label>
|
||||
</span>
|
||||
<input type="text" name="mail_address" id="mail_address" value="{$EMAIL}">
|
||||
</li>
|
||||
{if not $IN_ADMIN} {* admins do not need old password*}
|
||||
<li>
|
||||
<span class="property">
|
||||
<label for="password">{'Password'|@translate}</label>
|
||||
</span>
|
||||
<input type="password" name="password" id="password" value="">
|
||||
</li>
|
||||
{/if}
|
||||
<li>
|
||||
<span class="property">
|
||||
<label for="use_new_pwd">{'New password'|@translate}</label>
|
||||
@@ -35,7 +33,7 @@
|
||||
</span>
|
||||
<input type="password" name="passwordConf" id="passwordConf" value="">
|
||||
</li>
|
||||
{/if}
|
||||
{/if}
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
|
||||
@@ -347,6 +347,7 @@ $lang['User: %s'] = "User: %s";
|
||||
$lang['Username "%s" on gallery %s'] = 'Username "%s" on gallery %s';
|
||||
$lang['Username or email'] = 'Username or email';
|
||||
$lang['Username'] = "Username";
|
||||
$lang['Username modification'] = 'Username modification';
|
||||
$lang['View'] = "View";
|
||||
$lang['Visits'] = "Visits";
|
||||
$lang['Webmaster'] = "Webmaster";
|
||||
@@ -361,6 +362,7 @@ $lang['Your comment has been registered'] = "Your comment has been registered";
|
||||
$lang['Your comment has NOT been registered because it did not pass the validation rules'] = "Your comment has NOT been registered because it did not pass the validation rules";
|
||||
$lang['Your favorites'] = "Your favorites";
|
||||
$lang['Your Gallery Customization'] = "Your gallery customization";
|
||||
$lang['Your username has been successfully changed to : %s'] = 'Your username has been successfully changed to : %s';
|
||||
$lang['Your password has been reset'] = 'Your password has been reset';
|
||||
$lang['square'] = "Square";
|
||||
$lang['thumb'] = "Thumb";
|
||||
|
||||
@@ -365,5 +365,7 @@ $lang['Change my password'] = 'Changer mon mot de passe';
|
||||
$lang['Enter your new password below.'] = 'Entrez votre nouveau mot de passe ci-dessous.';
|
||||
$lang['EXIF Metadata'] = 'Données EXIF';
|
||||
$lang['IPTC Metadata'] = 'Données IPTC';
|
||||
$lang['Your username has been successfully changed to : %s'] = 'Votre nom d\'utilisateur a bien été changé par : %s';
|
||||
$lang['Username modification'] = 'Modification du nom d\'utilisateur';
|
||||
|
||||
?>
|
||||
@@ -347,6 +347,7 @@ $lang['User: %s'] = 'Utilisateur: %s';
|
||||
$lang['Username "%s" on gallery %s'] = 'Utilisateur "%s" sur la galerie %s';
|
||||
$lang['Username or email'] = 'Nom d\'utilisateur ou adresse email';
|
||||
$lang['Username'] = 'Nom d\'utilisateur';
|
||||
$lang['Username modification'] = 'Modification du nom d\'utilisateur';
|
||||
$lang['View'] = 'Vue';
|
||||
$lang['Visits'] = 'Visites';
|
||||
$lang['Webmaster'] = 'Webmestre';
|
||||
@@ -361,6 +362,7 @@ $lang['Your comment has been registered'] = 'Votre commentaire a été enregistr
|
||||
$lang['Your comment has NOT been registered because it did not pass the validation rules'] = 'Votre commentaire n\'a pas été enregistré parce qu\'il ne satisfait aux règles de validation';
|
||||
$lang['Your favorites'] = 'Mes favorites';
|
||||
$lang['Your Gallery Customization'] = 'Personnalisation de votre affichage ';
|
||||
$lang['Your username has been successfully changed to : %s'] = 'Votre nom d\'utilisateur a bien été changé par : %s';
|
||||
$lang['Your password has been reset'] = 'Votre mot de passe a été réinitialisé';
|
||||
|
||||
?>
|
||||
46
profile.php
46
profile.php
@@ -104,6 +104,7 @@ function save_profile_from_post($userdata, &$errors)
|
||||
if ($special_user)
|
||||
{
|
||||
unset(
|
||||
$_POST['username'],
|
||||
$_POST['mail_address'],
|
||||
$_POST['password'],
|
||||
$_POST['use_new_pwd'],
|
||||
@@ -114,6 +115,11 @@ function save_profile_from_post($userdata, &$errors)
|
||||
$_POST['theme'] = get_default_theme();
|
||||
$_POST['language'] = get_default_language();
|
||||
}
|
||||
|
||||
if (!defined('IN_ADMIN'))
|
||||
{
|
||||
unset($_POST['username']);
|
||||
}
|
||||
|
||||
if ($conf['allow_user_customization'] or defined('IN_ADMIN'))
|
||||
{
|
||||
@@ -196,12 +202,44 @@ function save_profile_from_post($userdata, &$errors)
|
||||
{
|
||||
array_push($fields, $conf['user_fields']['password']);
|
||||
// password is encrpyted with function $conf['pass_convert']
|
||||
$data{$conf['user_fields']['password']} =
|
||||
$conf['pass_convert']($_POST['use_new_pwd']);
|
||||
$data{$conf['user_fields']['password']} = $conf['pass_convert']($_POST['use_new_pwd']);
|
||||
}
|
||||
|
||||
// username is updated only if allowed
|
||||
if (!empty($_POST['username']))
|
||||
{
|
||||
array_push($fields, $conf['user_fields']['username']);
|
||||
$data{$conf['user_fields']['username']} = $_POST['username'];
|
||||
|
||||
// send email to the user
|
||||
if ($_POST['username'] != $userdata['username'])
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
|
||||
switch_lang_to($userdata['language']);
|
||||
|
||||
$keyargs_content = array(
|
||||
get_l10n_args('Hello', ''),
|
||||
get_l10n_args('Your username has been successfully changed to : %s', $_POST['username']),
|
||||
);
|
||||
|
||||
pwg_mail(
|
||||
$_POST['mail_address'],
|
||||
array(
|
||||
'subject' => '['.$conf['gallery_title'].'] '.l10n('Username modification'),
|
||||
'content' => l10n_args($keyargs_content),
|
||||
'content_format' => 'text/plain',
|
||||
)
|
||||
);
|
||||
|
||||
switch_lang_back();
|
||||
}
|
||||
}
|
||||
|
||||
mass_updates(USERS_TABLE,
|
||||
array('primary' => array($conf['user_fields']['id']),
|
||||
'update' => $fields),
|
||||
array(
|
||||
'primary' => array($conf['user_fields']['id']),
|
||||
'update' => $fields
|
||||
),
|
||||
array($data));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,21 +8,19 @@
|
||||
<span class="property">{'Username'|@translate}</span>
|
||||
{$USERNAME}
|
||||
</li>
|
||||
{if not $SPECIAL_USER} {* can modify password + email*}
|
||||
{if not $SPECIAL_USER} {* can modify password + email*}
|
||||
<li>
|
||||
<span class="property">
|
||||
<label for="mail_address">{'Email address'|@translate}</label>
|
||||
</span>
|
||||
<input type="text" name="mail_address" id="mail_address" value="{$EMAIL}">
|
||||
</li>
|
||||
{if not $IN_ADMIN} {* admins do not need old password*}
|
||||
<li>
|
||||
<span class="property">
|
||||
<label for="password">{'Password'|@translate}</label>
|
||||
</span>
|
||||
<input type="password" name="password" id="password" value="">
|
||||
</li>
|
||||
{/if}
|
||||
<li>
|
||||
<span class="property">
|
||||
<label for="use_new_pwd">{'New password'|@translate}</label>
|
||||
@@ -35,8 +33,8 @@
|
||||
</span>
|
||||
<input type="password" name="passwordConf" id="passwordConf" value="">
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
{/if}
|
||||
</fieldset>
|
||||
|
||||
{if $ALLOW_USER_CUSTOMIZATION}
|
||||
|
||||
Reference in New Issue
Block a user