]> source.dussan.org Git - nextcloud-server.git/commitdiff
fixes #4026
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 30 Jul 2013 08:26:42 +0000 (10:26 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 30 Jul 2013 15:34:15 +0000 (17:34 +0200)
core/js/share.js
lib/public/share.php

index 1fa76e62698afecece680d7c73463476a269e29b..8825186f23d00235b3c2b269bdd76e23e536b533 100644 (file)
@@ -581,8 +581,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) {
                });
        });
 
@@ -598,13 +597,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'));
                        });
                }
        });
index 9ea727a6a8565844b1dc7d95cf8fc65d63a0a9fc..cb7798874ac8044315f21f043f30f800ce267cbf 100644 (file)
@@ -455,6 +455,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