Skip to content

Commit 06b9e82

Browse files
nilsteampassnetnilsteampassnet
authored andcommitted
2.1.27
Fix for #2326
1 parent 9fa6152 commit 06b9e82

File tree

8 files changed

+68
-49
lines changed

8 files changed

+68
-49
lines changed

changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
2.1.27
2+
22/
3+
#2326 link copy doesn't work corectly
24

35
21/
46
#2398 User unable to change their own password from profile window

includes/config/include.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
global $SETTINGS, $languagesList, $SETTINGS_EXT;
1313

1414
$SETTINGS_EXT['version'] = "2.1.27";
15-
$SETTINGS_EXT['version_full'] = $SETTINGS_EXT['version'].".21";
15+
$SETTINGS_EXT['version_full'] = $SETTINGS_EXT['version'].".22";
1616
$SETTINGS_EXT['tool_name'] = "TeamPass";
1717
$SETTINGS_EXT['one_day_seconds'] = 86400;
1818
$SETTINGS_EXT['one_week_seconds'] = 604800;

includes/js/clipboard/clipboard.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

items.load.php

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ function(data) {
13051305

13061306
//Prepare clipboard copies
13071307
if ($('#edit_pw1').val() !== "") {
1308-
new Clipboard("#menu_button_copy_pw, #button_quick_pw_copy", {
1308+
new ClipboardJS("#menu_button_copy_pw, #button_quick_pw_copy", {
13091309
text: function() {
13101310
return unsanitizeString($('#edit_pw1').val());
13111311
}
@@ -1316,7 +1316,7 @@ function(data) {
13161316
$("#button_quick_pw_copy").addClass("hidden");
13171317
}
13181318
if ($('#edit_item_login').val() != "") {
1319-
var clipboard_elogin = new Clipboard("#menu_button_copy_login, #button_quick_login_copy", {
1319+
var clipboard_elogin = new ClipboardJS("#menu_button_copy_login, #button_quick_login_copy", {
13201320
text: function() {
13211321
return unsanitizeString($('#edit_item_login').val());
13221322
}
@@ -1830,7 +1830,7 @@ function(data_raw) {
18301830

18311831
//Prepare clipboard copies
18321832
if (data.pw != "") {
1833-
var clipboard_pw = new Clipboard("#menu_button_copy_pw, #button_quick_pw_copy", {
1833+
var clipboard_pw = new ClipboardJS("#menu_button_copy_pw, #button_quick_pw_copy", {
18341834
text: function() {
18351835
return (unsanitizeString(data.pw));
18361836
}
@@ -1851,7 +1851,7 @@ function(data_raw) {
18511851
$("#button_quick_pw_copy").addClass("hidden");
18521852
}
18531853
if (data.login != "") {
1854-
var clipboard_login = new Clipboard("#menu_button_copy_login, #button_quick_login_copy", {
1854+
var clipboard_login = new ClipboardJS("#menu_button_copy_login, #button_quick_login_copy", {
18551855
text: function() {
18561856
return (data.login);
18571857
}
@@ -1867,7 +1867,7 @@ function(data_raw) {
18671867
}
18681868
// #525
18691869
if (data.url != "") {
1870-
var clipboard_url = new Clipboard("#menu_button_copy_url", {
1870+
var clipboard_url = new ClipboardJS("#menu_button_copy_url", {
18711871
text: function() {
18721872
return unsanitizeString(data.url);
18731873
}
@@ -1880,7 +1880,7 @@ function(data_raw) {
18801880
}
18811881

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

2842-
var clear_tp_clipboard = new Clipboard("#but_empty_clipboard", {
2842+
var clear_tp_clipboard = new ClipboardJS("#but_empty_clipboard", {
28432843
text: function() {
28442844
return "cleared";
28452845
}
28462846
});
2847-
clear_tp_clipboard.on('success', function(e) {
2848-
$("#message_box").html("super").show().fadeOut(1000);
2849-
2850-
e.clearSelection();
2851-
});
28522847

28532848
$.ajaxSetup({
28542849
error: function(jqXHR, exception) {
@@ -3967,6 +3962,22 @@ function(data) {
39673962
});
39683963
//<=
39693964

3965+
3966+
// => OTV LINK
3967+
$("#dialog_otv").dialog({
3968+
bgiframe: true,
3969+
modal: true,
3970+
height:300,
3971+
autoOpen: false,
3972+
minWidth:750,
3973+
title: "<?php echo addslashes($LANG['request_access_to_item']); ?>",
3974+
close: function(event,ui) {
3975+
$(this).dialog('close');
3976+
}
3977+
});
3978+
//<=
3979+
3980+
39703981
// => ATTACHMENTS INIT
39713982
var uploader_attachments = new plupload.Uploader({
39723983
runtimes : "html5,flash,silverlight,html4",
@@ -4644,13 +4655,13 @@ function proceed_list_update(stop_proceeding)
46444655
$("#items_list_loader").addClass("hidden");
46454656

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

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

48344845

4846+
48354847
/*
48364848
* Launch the redirection to OTV page
48374849
*/
@@ -4851,30 +4863,15 @@ function prepareOneTimeView()
48514863
function(data) {
48524864
//check if format error
48534865
if (data.error == "") {
4854-
$("#div_dialog_message").dialog({
4855-
height:300,
4856-
minWidth:750,
4857-
close: function(event,ui) {
4858-
$("#div_dialog_message_text").html('');
4859-
$(this).dialog('close');
4860-
}
4861-
});
4862-
$("#div_dialog_message").dialog('open');
4863-
$("#div_dialog_message_text").html(data.url+
4864-
'<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>'
4865-
);
4866-
4867-
var clipboard = new Clipboard("#" + data.element_id, {
4868-
text: function(trigger) {
4869-
return $('#' + data.element_id).data('clipboard-text');
4870-
}
4871-
});
4872-
clipboard.on('success', function(e) {
4873-
$("#show_otv_copied").html("<?php echo addslashes($LANG['link_is_copied']); ?>").show().fadeOut(2000);
4874-
e.clearSelection();
4875-
});
4866+
var str = "<?php echo addslashes($LANG['one_time_view_item_url_box']);?>";
4867+
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>');
4868+
html = html.replace("#DAY#", data.date);
4869+
$('#dialog_otv_text').html(html);
4870+
4871+
$('.tip').tooltipster({multiple: true});
48764872

4877-
$(".tip").tooltipster({multiple: true});
4873+
$('#otv-url').val(data.url);
4874+
$("#dialog_otv").dialog('open');
48784875
} else {
48794876
$("#item_history_log_error").html(data.error).show();
48804877
}

items.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@
146146
<input type="hidden" id="item_user_token" value="" />
147147
<input type="hidden" id="items_listing_should_stop" value="" />
148148
<input type="hidden" id="new_listing_characteristics" value="" />
149-
<input type="hidden" id="uniqueLoadData" value="" />';
149+
<input type="hidden" id="uniqueLoadData" value="" />
150+
<input type="hidden" id="otv-url" value="" />';
150151

151152
echo '
152153
<div id="div_items">';
@@ -1083,4 +1084,10 @@
10831084
</div>
10841085
</div>';
10851086

1087+
// Alert BOX
1088+
echo '
1089+
<div id="dialog_otv" style="display:none;">
1090+
<div id="dialog_otv_text" style="text-align:center; padding:4px; font-size:12px; margin-top:10px;"></div>
1091+
</div>';
1092+
10861093
require_once 'items.load.php';

load.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,23 @@ function(data) {
14811481
}
14821482

14831483
$htmlHeaders .= '
1484+
1485+
var clipboardOTV = new ClipboardJS(".otv-link", {
1486+
container: document.getElementById("dialog_otv"),
1487+
text: function(trigger) {
1488+
return $("#otv-url").val();
1489+
}
1490+
});
1491+
1492+
clipboardOTV.on("success", function(e) {
1493+
$("#dialog_otv").dialog("close");
1494+
$("#message_box")
1495+
.html("'.addslashes($LANG['url_copied_clipboard']).'")
1496+
.show()
1497+
.fadeOut(1000);
1498+
e.clearSelection();
1499+
});
1500+
14841501
setTimeout(function() { NProgress.done(); $(".fade").removeClass("out"); }, 1000);
14851502
});';
14861503

sources/items.queries.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4026,12 +4026,8 @@
40264026
echo json_encode(
40274027
array(
40284028
"error" => "",
4029-
"url" => str_replace(
4030-
array("#URL#", "#DAY#"),
4031-
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),
4032-
$LANG['one_time_view_item_url_box']
4033-
),
4034-
'element_id' => $element_id
4029+
'url' => $url,
4030+
'date' => $exp_date,
40354031
)
40364032
);
40374033
break;

ssh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function(data) {
208208
$('#edit_pw1').val($('#ausp_pwd').val());
209209
$("#hid_pw").val($('#ausp_pwd').val());
210210
// change quick password
211-
new Clipboard("#menu_button_copy_pw, #button_quick_pw_copy", {
211+
new ClipboardJS("#menu_button_copy_pw, #button_quick_pw_copy", {
212212
text: function() {
213213
return unsanitizeString($('#edit_pw1').val());
214214
}

0 commit comments

Comments
 (0)