aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-07-30 10:26:42 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-07-30 10:26:42 +0200
commit17c36b50746555444c34feb70147a5fbc1d6ac3c (patch)
treef53251cb83938697691f0e6f6769a78996acb011
parent88e1ccbce3f8a052875a5079836cb6515b6acf17 (diff)
downloadnextcloud-server-17c36b50746555444c34feb70147a5fbc1d6ac3c.tar.gz
nextcloud-server-17c36b50746555444c34feb70147a5fbc1d6ac3c.zip
fixes #4026
-rw-r--r--core/js/share.js30
-rw-r--r--lib/public/share.php3
2 files changed, 24 insertions, 9 deletions
diff --git a/core/js/share.js b/core/js/share.js
index e59669cbc2b..b4b5159b0b5 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -592,8 +592,7 @@ $(document).ready(function() {
}
// Update the share information
- OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, function(data) {
- return;
+ OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, function(data) {
});
});
@@ -609,13 +608,26 @@ $(document).ready(function() {
});
$(document).on('focusout keyup', '#dropdown #linkPassText', function(event) {
- if ( $('#linkPassText').val() != '' && (event.type == 'focusout' || event.keyCode == 13) ) {
- var itemType = $('#dropdown').data('item-type');
- var itemSource = $('#dropdown').data('item-source');
- OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $('#linkPassText').val(), OC.PERMISSION_READ, function() {
- console.log("password set to: '" + $('#linkPassText').val() +"' by event: " + event.type);
- $('#linkPassText').val('');
- $('#linkPassText').attr('placeholder', t('core', 'Password protected'));
+ var linkPassText = $('#linkPassText');
+ if ( linkPassText.val() != '' && (event.type == 'focusout' || event.keyCode == 13) ) {
+
+ var allowPublicUpload = $('#sharingDialogAllowPublicUpload').is(':checked');
+ var dropDown = $('#dropdown');
+ var itemType = dropDown.data('item-type');
+ var itemSource = dropDown.data('item-source');
+ var permissions = 0;
+
+ // Calculate permissions
+ if (allowPublicUpload) {
+ permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ;
+ } else {
+ permissions = OC.PERMISSION_READ;
+ }
+
+ OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $('#linkPassText').val(), permissions, function() {
+ console.log("password set to: '" + linkPassText.val() +"' by event: " + event.type);
+ linkPassText.val('');
+ linkPassText.attr('placeholder', t('core', 'Password protected'));
});
}
});
diff --git a/lib/public/share.php b/lib/public/share.php
index 596a729a47d..b349dd48776 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -454,6 +454,9 @@ class Share {
$forcePortable = (CRYPT_BLOWFISH != 1);
$hasher = new \PasswordHash(8, $forcePortable);
$shareWith = $hasher->HashPassword($shareWith.\OC_Config::getValue('passwordsalt', ''));
+ } else {
+ // reuse the already set password
+ $shareWith = $checkExists['share_with'];
}
// Generate token