mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
fixes #2189 remove password link input text when email is sent
I've also modified the messages
This commit is contained in:
@@ -2191,7 +2191,7 @@ function add_infos_to_new_user(user_id, ajax_data) {
|
||||
// add_user_close();
|
||||
$('#AddUserUpdated').removeClass('icon-red icon-cancel').addClass('icon-green border-green icon-ok');
|
||||
$('#AddUserUpdatedText').html(user_added_str.replace("%s", ajax_data.username));
|
||||
send_new_user_password(new_user_id, ajax_data.email === '' ? false : true);
|
||||
send_new_user_password(new_user_id, ajax_data.email);
|
||||
$("#AddUser .user-property-input").val("");
|
||||
$("#AddUserSuccess .edit-now").off("click").on("click", () => {
|
||||
last_user_id = new_user_id;
|
||||
@@ -2215,7 +2215,8 @@ function add_infos_to_new_user(user_id, ajax_data) {
|
||||
});
|
||||
}
|
||||
|
||||
function send_new_user_password(user_id, send_by_mail) {
|
||||
function send_new_user_password(user_id, mail) {
|
||||
let send_by_mail = mail === '' ? false : true;
|
||||
$.ajax({
|
||||
url: "ws.php?format=json",
|
||||
dataType: "json",
|
||||
@@ -2227,14 +2228,19 @@ function send_new_user_password(user_id, send_by_mail) {
|
||||
},
|
||||
success: function(response) {
|
||||
if('ok' === response.stat) {
|
||||
const password_container = $('#AddUserPasswordInputContainer');
|
||||
password_container.show();
|
||||
$('#AddUserFieldContainer').hide();
|
||||
$('#AddUserSuccessContainer').fadeIn();
|
||||
$('#AddUserPasswordLink').val(response.result.generated_link).trigger('focus');
|
||||
$('#AddUserTextField').html(send_by_mail ? validLinkMail : validLinkWithoutMail);
|
||||
$('#AddUserTextField').html(send_by_mail ? sprintf(validLinkMail, `<b>${mail}</b>`) : validLinkWithoutMail);
|
||||
|
||||
if(send_by_mail && !response.result.send_by_mail) {
|
||||
$('#AddUserUpdated').removeClass('icon-green border-green icon-ok').addClass('icon-red-error icon-cancel');
|
||||
$('#AddUserUpdatedText').html(errorMailSent);
|
||||
$('#AddUserTextField').html(errorMailSentMsg);
|
||||
} else if (send_by_mail && response.result.send_by_mail) {
|
||||
password_container.hide();
|
||||
}
|
||||
|
||||
if (window.isSecureContext && navigator.clipboard) {
|
||||
|
||||
@@ -45,8 +45,9 @@ const mainUserUpgradeWebmaster = "{'This user must first be defined as the webma
|
||||
const errorStr = "{'an error happened'|@translate|escape:javascript}";
|
||||
const copyLinkStr = "{'Copied link'|@translate|escape:javascript}";
|
||||
const cantCopy = "{'You cannot copy the password if the connection to this site is not secure.'|@translate|escape:javascript}";
|
||||
const validLinkMail = "{'A link, valid for 3 days has already been sent. If the email fails, copy the link below and send it to the user so the password can be set.'|@translate|escape:javascript}";
|
||||
const validLinkWithoutMail = "{'Copy the link below and send it to the user so the password can be set'|@translate|escape:javascript}";
|
||||
const validLinkMail = "{'An activation link valid for 1 hour has been sent to "%s". If the user doesn\'t receive the link, you can generate and copy a new one by editing the user and managing her password.'|@translate|escape:javascript}";
|
||||
const validLinkWithoutMail = "{'Copy the link below and send it to the user so the password can be set.'|@translate|escape:javascript}";
|
||||
const errorMailSentMsg = "{'An activation link valid for 1 hour was created but could not be sent. You can now copy the link below and send it to the user.'|@translate|escape:javascript}";
|
||||
|
||||
const registered_str = '{"Registered"|@translate|escape:javascript}';
|
||||
const last_visit_str = '{"Last visit"|@translate|escape:javascript}';
|
||||
@@ -1222,8 +1223,8 @@ $(document).ready(function() {
|
||||
|
||||
<div id="AddUserSuccessContainer" style="display: none;">
|
||||
<p class="icon-green border-green icon-ok AddUserResult" id="AddUserUpdated"> <span id="AddUserUpdatedText">{'User updated'|@translate}</span></p>
|
||||
<p class="AddUserTextField" id="AddUserTextField">A link, valid for 3 days has already been sent. If the email fails, copy the link below and send it to the user so the password can be set.</p>
|
||||
<div class="AddUserPasswordInputContainer">
|
||||
<p class="AddUserTextField" id="AddUserTextField"></p>
|
||||
<div class="AddUserPasswordInputContainer" id="AddUserPasswordInputContainer">
|
||||
<input class="AddUserPasswordInput" id="AddUserPasswordLink" />
|
||||
<span class="icon-docs" id="AddUserCopyPassword"></span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user