Skip to content

Commit

Permalink
2.1.27
Browse files Browse the repository at this point in the history
Fix for #2326
  • Loading branch information
nilsteampassnet authored and nilsteampassnet committed Sep 4, 2018
1 parent 9fa6152 commit 06b9e82
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 49 deletions.
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
2.1.27
22/
#2326 link copy doesn't work corectly

21/
#2398 User unable to change their own password from profile window
Expand Down
2 changes: 1 addition & 1 deletion includes/config/include.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
global $SETTINGS, $languagesList, $SETTINGS_EXT;

$SETTINGS_EXT['version'] = "2.1.27";
$SETTINGS_EXT['version_full'] = $SETTINGS_EXT['version'].".21";
$SETTINGS_EXT['version_full'] = $SETTINGS_EXT['version'].".22";
$SETTINGS_EXT['tool_name'] = "TeamPass";
$SETTINGS_EXT['one_day_seconds'] = 86400;
$SETTINGS_EXT['one_week_seconds'] = 604800;
Expand Down
6 changes: 3 additions & 3 deletions includes/js/clipboard/clipboard.min.js

Large diffs are not rendered by default.

71 changes: 34 additions & 37 deletions items.load.php
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,7 @@ function(data) {

//Prepare clipboard copies
if ($('#edit_pw1').val() !== "") {
new Clipboard("#menu_button_copy_pw, #button_quick_pw_copy", {
new ClipboardJS("#menu_button_copy_pw, #button_quick_pw_copy", {
text: function() {
return unsanitizeString($('#edit_pw1').val());
}
Expand All @@ -1316,7 +1316,7 @@ function(data) {
$("#button_quick_pw_copy").addClass("hidden");
}
if ($('#edit_item_login').val() != "") {
var clipboard_elogin = new Clipboard("#menu_button_copy_login, #button_quick_login_copy", {
var clipboard_elogin = new ClipboardJS("#menu_button_copy_login, #button_quick_login_copy", {
text: function() {
return unsanitizeString($('#edit_item_login').val());
}
Expand Down Expand Up @@ -1830,7 +1830,7 @@ function(data_raw) {

//Prepare clipboard copies
if (data.pw != "") {
var clipboard_pw = new Clipboard("#menu_button_copy_pw, #button_quick_pw_copy", {
var clipboard_pw = new ClipboardJS("#menu_button_copy_pw, #button_quick_pw_copy", {
text: function() {
return (unsanitizeString(data.pw));
}
Expand All @@ -1851,7 +1851,7 @@ function(data_raw) {
$("#button_quick_pw_copy").addClass("hidden");
}
if (data.login != "") {
var clipboard_login = new Clipboard("#menu_button_copy_login, #button_quick_login_copy", {
var clipboard_login = new ClipboardJS("#menu_button_copy_login, #button_quick_login_copy", {
text: function() {
return (data.login);
}
Expand All @@ -1867,7 +1867,7 @@ function(data_raw) {
}
// #525
if (data.url != "") {
var clipboard_url = new Clipboard("#menu_button_copy_url", {
var clipboard_url = new ClipboardJS("#menu_button_copy_url", {
text: function() {
return unsanitizeString(data.url);
}
Expand All @@ -1880,7 +1880,7 @@ function(data_raw) {
}

//prepare link to clipboard
var clipboard_link = new Clipboard("#menu_button_copy_link", {
var clipboard_link = new ClipboardJS("#menu_button_copy_link", {
text: function() {
return "<?php echo $SETTINGS['cpassman_url']; ?>"+"/index.php?page=items&group="+data.folder+"&id="+data.id;
}
Expand Down Expand Up @@ -2839,16 +2839,11 @@ function openReasonToAccess() {
//###########
$(function() {

var clear_tp_clipboard = new Clipboard("#but_empty_clipboard", {
var clear_tp_clipboard = new ClipboardJS("#but_empty_clipboard", {
text: function() {
return "cleared";
}
});
clear_tp_clipboard.on('success', function(e) {
$("#message_box").html("super").show().fadeOut(1000);

e.clearSelection();
});

$.ajaxSetup({
error: function(jqXHR, exception) {
Expand Down Expand Up @@ -3967,6 +3962,22 @@ function(data) {
});
//<=


// => OTV LINK
$("#dialog_otv").dialog({
bgiframe: true,
modal: true,
height:300,
autoOpen: false,
minWidth:750,
title: "<?php echo addslashes($LANG['request_access_to_item']); ?>",
close: function(event,ui) {
$(this).dialog('close');
}
});
//<=


// => ATTACHMENTS INIT
var uploader_attachments = new plupload.Uploader({
runtimes : "html5,flash,silverlight,html4",
Expand Down Expand Up @@ -4644,13 +4655,13 @@ function proceed_list_update(stop_proceeding)
$("#items_list_loader").addClass("hidden");

// prepare clipboard items
clipboard = new Clipboard('.mini_login');
clipboard = new ClipboardJS('.mini_login');
clipboard.on('success', function(e) {
$("#message_box").html("<?php echo addslashes($LANG['login_copied_clipboard']); ?>").show().fadeOut(1000);
e.clearSelection();
});

clipboard = new Clipboard('.mini_pw');
clipboard = new ClipboardJS('.mini_pw');
clipboard.on('success', function(e) {
$("#message_box").html("<?php echo addslashes($LANG['pw_copied_clipboard']); ?>").show().fadeOut(1000);
itemLog(
Expand Down Expand Up @@ -4832,6 +4843,7 @@ function(data) {
}



/*
* Launch the redirection to OTV page
*/
Expand All @@ -4851,30 +4863,15 @@ function prepareOneTimeView()
function(data) {
//check if format error
if (data.error == "") {
$("#div_dialog_message").dialog({
height:300,
minWidth:750,
close: function(event,ui) {
$("#div_dialog_message_text").html('');
$(this).dialog('close');
}
});
$("#div_dialog_message").dialog('open');
$("#div_dialog_message_text").html(data.url+
'<div style="margin-top:30px;font-size:13px;text-align:center;"><span id="show_otv_copied" class="ui-state-focus ui-corner-all" style="padding:10px;display:none;"></span></div>'
);

var clipboard = new Clipboard("#" + data.element_id, {
text: function(trigger) {
return $('#' + data.element_id).data('clipboard-text');
}
});
clipboard.on('success', function(e) {
$("#show_otv_copied").html("<?php echo addslashes($LANG['link_is_copied']); ?>").show().fadeOut(2000);
e.clearSelection();
});
var str = "<?php echo addslashes($LANG['one_time_view_item_url_box']);?>";
var html = str.replace("#URL#", data.url + '<i class="fa-stack tip otv-link" title="<?php echo addslashes($LANG['copy']);?>" style="cursor:pointer;"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-clipboard fa-stack-1x fa-inverse"></span></i>');
html = html.replace("#DAY#", data.date);
$('#dialog_otv_text').html(html);

$('.tip').tooltipster({multiple: true});

$(".tip").tooltipster({multiple: true});
$('#otv-url').val(data.url);
$("#dialog_otv").dialog('open');
} else {
$("#item_history_log_error").html(data.error).show();
}
Expand Down
9 changes: 8 additions & 1 deletion items.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@
<input type="hidden" id="item_user_token" value="" />
<input type="hidden" id="items_listing_should_stop" value="" />
<input type="hidden" id="new_listing_characteristics" value="" />
<input type="hidden" id="uniqueLoadData" value="" />';
<input type="hidden" id="uniqueLoadData" value="" />
<input type="hidden" id="otv-url" value="" />';

echo '
<div id="div_items">';
Expand Down Expand Up @@ -1083,4 +1084,10 @@
</div>
</div>';

// Alert BOX
echo '
<div id="dialog_otv" style="display:none;">
<div id="dialog_otv_text" style="text-align:center; padding:4px; font-size:12px; margin-top:10px;"></div>
</div>';

require_once 'items.load.php';
17 changes: 17 additions & 0 deletions load.php
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,23 @@ function(data) {
}

$htmlHeaders .= '
var clipboardOTV = new ClipboardJS(".otv-link", {
container: document.getElementById("dialog_otv"),
text: function(trigger) {
return $("#otv-url").val();
}
});
clipboardOTV.on("success", function(e) {
$("#dialog_otv").dialog("close");
$("#message_box")
.html("'.addslashes($LANG['url_copied_clipboard']).'")
.show()
.fadeOut(1000);
e.clearSelection();
});
setTimeout(function() { NProgress.done(); $(".fade").removeClass("out"); }, 1000);
});';

Expand Down
8 changes: 2 additions & 6 deletions sources/items.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -4026,12 +4026,8 @@
echo json_encode(
array(
"error" => "",
"url" => str_replace(
array("#URL#", "#DAY#"),
array('<span id="otv_link">'.$url.'</span>&nbsp;<i class="fa-stack tip clipboard-icon" title="'.addslashes($LANG['copy']).'" style="cursor:pointer;" id="'.$element_id.'" data-clipboard-text="'.$url.'"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-clipboard fa-stack-1x fa-inverse"></span></i>', $exp_date),
$LANG['one_time_view_item_url_box']
),
'element_id' => $element_id
'url' => $url,
'date' => $exp_date,
)
);
break;
Expand Down
2 changes: 1 addition & 1 deletion ssh.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function(data) {
$('#edit_pw1').val($('#ausp_pwd').val());
$("#hid_pw").val($('#ausp_pwd').val());
// change quick password
new Clipboard("#menu_button_copy_pw, #button_quick_pw_copy", {
new ClipboardJS("#menu_button_copy_pw, #button_quick_pw_copy", {
text: function() {
return unsanitizeString($('#edit_pw1').val());
}
Expand Down

0 comments on commit 06b9e82

Please sign in to comment.