Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
d84d040d
Commit
d84d040d
authored
Oct 18, 2016
by
Vincent Petry
Committed by
GitHub
Oct 18, 2016
Browse files
Merge pull request #26376 from tbenk/endorse-password-for-share-link
feature endorse password for share links
parents
8c1b2528
f677acd6
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/js/config.php
View file @
d84d040d
...
...
@@ -64,6 +64,9 @@ $outgoingServer2serverShareEnabled = $config->getAppValue('files_sharing', 'outg
$countOfDataLocation
=
0
;
$value
=
$config
->
getAppValue
(
'core'
,
'shareapi_enable_link_password_by_default'
,
'no'
);
$enableLinkPasswordByDefault
=
(
$value
===
'yes'
)
?
true
:
false
;
$dataLocation
=
str_replace
(
OC
::
$SERVERROOT
.
'/'
,
''
,
$config
->
getSystemValue
(
'datadirectory'
,
''
),
$countOfDataLocation
);
if
(
$countOfDataLocation
!==
1
||
!
OC_User
::
isAdminUser
(
OC_User
::
getUser
())){
$dataLocation
=
false
;
...
...
@@ -159,6 +162,7 @@ $array = [
'defaultExpireDate'
=>
$defaultExpireDate
,
'defaultExpireDateEnforced'
=>
$enforceDefaultExpireDate
,
'enforcePasswordForPublicLink'
=>
\
OCP\Util
::
isPublicLinkPasswordRequired
(),
'enableLinkPasswordByDefault'
=>
$enableLinkPasswordByDefault
,
'sharingDisabledForUser'
=>
\
OCP\Util
::
isSharingDisabledForUser
(),
'resharingAllowed'
=>
\
OCP\Share
::
isResharingAllowed
(),
'remoteShareAllowed'
=>
$outgoingServer2serverShareEnabled
,
...
...
core/js/shareconfigmodel.js
View file @
d84d040d
...
...
@@ -22,6 +22,7 @@
defaults
:
{
publicUploadEnabled
:
false
,
enforcePasswordForPublicLink
:
oc_appconfig
.
core
.
enforcePasswordForPublicLink
,
enableLinkPasswordByDefault
:
oc_appconfig
.
core
.
enableLinkPasswordByDefault
,
isDefaultExpireDateEnforced
:
oc_appconfig
.
core
.
defaultExpireDateEnforced
===
true
,
isDefaultExpireDateEnabled
:
oc_appconfig
.
core
.
defaultExpireDateEnabled
===
true
,
isRemoteShareAllowed
:
oc_appconfig
.
core
.
remoteShareAllowed
,
...
...
core/js/sharedialoglinkshareview.js
View file @
d84d040d
...
...
@@ -15,6 +15,7 @@
var
PASSWORD_PLACEHOLDER
=
'
**********
'
;
var
PASSWORD_PLACEHOLDER_MESSAGE
=
t
(
'
core
'
,
'
Choose a password for the public link
'
);
var
PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL
=
t
(
'
core
'
,
'
Choose a password for the public link or press enter
'
);
var
TEMPLATE
=
'
{{#if shareAllowed}}
'
+
...
...
@@ -40,7 +41,11 @@
'
{{/if}}
'
+
'
<div id="linkPass" class="linkPass {{#unless isPasswordSet}}hidden{{/unless}}">
'
+
'
<label for="linkPassText-{{cid}}" class="hidden-visually">{{passwordLabel}}</label>
'
+
'
{{#if showPasswordCheckBox}}
'
+
'
<input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholder}}" />
'
+
'
{{else}}
'
+
'
<input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholderInitial}}" />
'
+
'
{{/if}}
'
+
'
<span class="icon-loading-small hidden"></span>
'
+
'
</div>
'
+
'
{{else}}
'
+
...
...
@@ -157,7 +162,7 @@
}
if
(
$checkBox
.
is
(
'
:checked
'
))
{
if
(
this
.
configModel
.
get
(
'
enforcePasswordForPublicLink
'
)
===
false
)
{
if
(
this
.
configModel
.
get
(
'
enforcePasswordForPublicLink
'
)
===
false
&&
this
.
configModel
.
get
(
'
enableLinkPasswordByDefault
'
)
===
false
)
{
$loading
.
removeClass
(
'
hidden
'
);
// this will create it
this
.
model
.
saveLinkShare
();
...
...
@@ -207,9 +212,19 @@
var
$input
=
this
.
$el
.
find
(
'
.linkPassText
'
);
$input
.
removeClass
(
'
error
'
);
var
password
=
$input
.
val
();
// in IE9 the password might be the placeholder due to bugs in the placeholders polyfill
if
(
password
===
''
||
password
===
PASSWORD_PLACEHOLDER
||
password
===
PASSWORD_PLACEHOLDER_MESSAGE
)
{
return
;
if
(
this
.
$el
.
find
(
'
.linkPassText
'
).
attr
(
'
placeholder
'
)
===
PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL
)
{
// in IE9 the password might be the placeholder due to bugs in the placeholders polyfill
if
(
password
===
PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL
)
{
password
=
''
;
}
}
else
{
// in IE9 the password might be the placeholder due to bugs in the placeholders polyfill
if
(
password
===
''
||
password
===
PASSWORD_PLACEHOLDER
||
password
===
PASSWORD_PLACEHOLDER_MESSAGE
)
{
return
;
}
}
$loading
...
...
@@ -277,6 +292,8 @@
var
showPasswordCheckBox
=
isLinkShare
&&
(
!
this
.
configModel
.
get
(
'
enforcePasswordForPublicLink
'
)
||
!
this
.
model
.
get
(
'
linkShare
'
).
password
);
var
passwordPlaceholderInitial
=
this
.
configModel
.
get
(
'
enforcePasswordForPublicLink
'
)
?
PASSWORD_PLACEHOLDER_MESSAGE
:
PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL
;
this
.
$el
.
html
(
linkShareTemplate
({
cid
:
this
.
cid
,
...
...
@@ -288,6 +305,7 @@
enablePasswordLabel
:
t
(
'
core
'
,
'
Password protect
'
),
passwordLabel
:
t
(
'
core
'
,
'
Password
'
),
passwordPlaceholder
:
isPasswordSet
?
PASSWORD_PLACEHOLDER
:
PASSWORD_PLACEHOLDER_MESSAGE
,
passwordPlaceholderInitial
:
passwordPlaceholderInitial
,
isPasswordSet
:
isPasswordSet
,
showPasswordCheckBox
:
showPasswordCheckBox
,
publicUpload
:
publicUpload
&&
isLinkShare
,
...
...
settings/admin.php
View file @
d84d040d
...
...
@@ -133,6 +133,7 @@ $template->assign('suggestedOverwriteCliUrl', $suggestedOverwriteCliUrl);
$template
->
assign
(
'allowLinks'
,
$config
->
getAppValue
(
'core'
,
'shareapi_allow_links'
,
'yes'
));
$template
->
assign
(
'enforceLinkPassword'
,
\
OCP\Util
::
isPublicLinkPasswordRequired
());
$template
->
assign
(
'enableLinkPasswordByDefault'
,
$config
->
getAppValue
(
'core'
,
'shareapi_enable_link_password_by_default'
,
'no'
));
$template
->
assign
(
'allowPublicUpload'
,
$config
->
getAppValue
(
'core'
,
'shareapi_allow_public_upload'
,
'yes'
));
$template
->
assign
(
'allowResharing'
,
$config
->
getAppValue
(
'core'
,
'shareapi_allow_resharing'
,
'yes'
));
$template
->
assign
(
'allowPublicMailNotification'
,
$config
->
getAppValue
(
'core'
,
'shareapi_allow_public_notification'
,
'no'
));
...
...
settings/templates/admin.php
View file @
d84d040d
...
...
@@ -212,6 +212,10 @@ if ($_['cronErrors']) {
value=
"1"
<?php
if
(
$_
[
'allowPublicUpload'
]
==
'yes'
)
print_unescaped
(
'checked="checked"'
);
?>
/>
<label
for=
"allowPublicUpload"
>
<?php
p
(
$l
->
t
(
'Allow public uploads'
));
?>
</label><br/>
<input
type=
"checkbox"
name=
"shareapi_enable_link_password_by_default"
id=
"enableLinkPasswordByDefault"
class=
"checkbox"
value=
"1"
<?php
if
(
$_
[
'enableLinkPasswordByDefault'
]
===
'yes'
)
print_unescaped
(
'checked="checked"'
);
?>
/>
<label
for=
"enableLinkPasswordByDefault"
>
<?php
p
(
$l
->
t
(
'Always ask for a password'
));
?>
</label><br/>
<input
type=
"checkbox"
name=
"shareapi_enforce_links_password"
id=
"enforceLinkPassword"
class=
"checkbox"
value=
"1"
<?php
if
(
$_
[
'enforceLinkPassword'
])
print_unescaped
(
'checked="checked"'
);
?>
/>
<label
for=
"enforceLinkPassword"
>
<?php
p
(
$l
->
t
(
'Enforce password protection'
));
?>
</label><br/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment