Updated password.js (ES2015)
This commit is contained in:
parent
710aa2bf52
commit
9e976b1856
BIN
dist/main.js
vendored
BIN
dist/main.js
vendored
Binary file not shown.
@ -11,27 +11,25 @@ password = {
|
|||||||
|
|
||||||
password.get = function(albumID, callback, passwd) {
|
password.get = function(albumID, callback, passwd) {
|
||||||
|
|
||||||
var params;
|
if (lychee.publicMode===false) callback()
|
||||||
|
else if (album.json && album.json.password==='0') callback()
|
||||||
if (lychee.publicMode===false) callback();
|
else if (albums.json && albums.getByID(albumID).password==='0') callback()
|
||||||
else if (album.json&&album.json.password==='0') callback();
|
|
||||||
else if (albums.json&&albums.getByID(albumID).password==='0') callback();
|
|
||||||
else if (!albums.json && !album.json) {
|
else if (!albums.json && !album.json) {
|
||||||
|
|
||||||
// Continue without password
|
// Continue without password
|
||||||
album.json = {password: true};
|
album.json = { password: true }
|
||||||
callback('');
|
callback('')
|
||||||
|
|
||||||
} else if (passwd==null) {
|
} else if (passwd==null) {
|
||||||
|
|
||||||
// Request password
|
// Request password
|
||||||
password.getDialog(albumID, callback);
|
password.getDialog(albumID, callback)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Check password
|
// Check password
|
||||||
|
|
||||||
params = {
|
let params = {
|
||||||
albumID,
|
albumID,
|
||||||
password: passwd
|
password: passwd
|
||||||
}
|
}
|
||||||
@ -39,14 +37,14 @@ password.get = function(albumID, callback, passwd) {
|
|||||||
api.post('Album::getPublic', params, function(data) {
|
api.post('Album::getPublic', params, function(data) {
|
||||||
|
|
||||||
if (data===true) {
|
if (data===true) {
|
||||||
basicModal.close();
|
basicModal.close()
|
||||||
password.value = passwd;
|
password.value = passwd
|
||||||
callback();
|
callback()
|
||||||
} else {
|
} else {
|
||||||
basicModal.error('password');
|
basicModal.error('password')
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,18 +52,14 @@ password.get = function(albumID, callback, passwd) {
|
|||||||
|
|
||||||
password.getDialog = function(albumID, callback) {
|
password.getDialog = function(albumID, callback) {
|
||||||
|
|
||||||
var action,
|
const action = (data) => password.get(albumID, callback, data.password)
|
||||||
cancel,
|
|
||||||
msg = '';
|
|
||||||
|
|
||||||
action = function(data) { password.get(albumID, callback, data.password) }
|
const cancel = () => {
|
||||||
|
basicModal.close()
|
||||||
cancel = function() {
|
if (visible.albums()===false) lychee.goto()
|
||||||
basicModal.close();
|
|
||||||
if (visible.albums()===false) lychee.goto();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = `
|
let msg = `
|
||||||
<p>
|
<p>
|
||||||
This album is protected by a password. Enter the password below to view the photos of this album:
|
This album is protected by a password. Enter the password below to view the photos of this album:
|
||||||
<input name='password' class='text' type='password' placeholder='password' value=''>
|
<input name='password' class='text' type='password' placeholder='password' value=''>
|
||||||
@ -84,6 +78,6 @@ password.getDialog = function(albumID, callback) {
|
|||||||
fn: cancel
|
fn: cancel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user