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
460c5ca7
Commit
460c5ca7
authored
Oct 17, 2016
by
Timo Benk
Browse files
let the user set an empty password for share link
parent
65eddefe
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/js/sharedialoglinkshareview.js
View file @
460c5ca7
...
...
@@ -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}}
'
+
...
...
@@ -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
,
...
...
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