Fixed album sharing with password protection

This commit is contained in:
Tobias Reich 2015-01-30 00:20:11 +01:00
parent a2821a8238
commit 20bcac4dd2

View File

@ -376,11 +376,36 @@ album.setPublic = function(albumID, e) {
}; };
msg = "<p class='less'>This album will be shared with the following properties:</p><form>"; msg = `
msg += "<div class='choice'><label><input type='checkbox' name='listed' checked><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Visible</span></label><p>Listed to visitors of your Lychee.</p></div>"; <p class='less'>This album will be shared with the following properties:</p>
msg += "<div class='choice'><label><input type='checkbox' name='downloadable'><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Downloadable</span></label><p>Visitors of your Lychee can download this album.</p></div>"; <form>
msg += "<div class='choice'><label><input type='checkbox' name='password'><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Password protected</span></label><p>Only accessible with a valid password.</p><input class='text' data-name='password' type='password' placeholder='password' value=''></div>"; <div class='choice'>
msg += "</form>" <label>
<input type='checkbox' name='listed' checked>
<span class='checkbox'>${ build.iconic('check') }</span>
<span class='label'>Visible</span>
</label>
<p>Listed to visitors of your Lychee.</p>
</div>
<div class='choice'>
<label>
<input type='checkbox' name='downloadable'>
<span class='checkbox'>${ build.iconic('check') }</span>
<span class='label'>Downloadable</span>
</label>
<p>Visitors of your Lychee can download this album.</p>
</div>
<div class='choice'>
<label>
<input type='checkbox' name='password'>
<span class='checkbox'>${ build.iconic('check') }</span>
<span class='label'>Password protected</span>
</label>
<p>Only accessible with a valid password.</p>
<input class='text' data-name='password' type='password' placeholder='password' value=''>
</div>
</form>
`
basicModal.show({ basicModal.show({
body: msg, body: msg,
@ -410,7 +435,7 @@ album.setPublic = function(albumID, e) {
if (basicModal.visible()) { if (basicModal.visible()) {
if ($('.basicModal .choice input[name="password"]:checked').length===1) { if ($('.basicModal .choice input[name="password"]:checked').length===1) {
password = md5($('.basicModal .choice input[name="password"]').val()); password = md5($('.basicModal .choice input[data-name="password"]').val());
album.json.password = 1; album.json.password = 1;
} else { } else {
password = ''; password = '';