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) {
|
||||
|
||||
var params;
|
||||
|
||||
if (lychee.publicMode===false) callback();
|
||||
else if (album.json&&album.json.password==='0') callback();
|
||||
else if (albums.json&&albums.getByID(albumID).password==='0') callback();
|
||||
if (lychee.publicMode===false) 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) {
|
||||
|
||||
// Continue without password
|
||||
album.json = {password: true};
|
||||
callback('');
|
||||
album.json = { password: true }
|
||||
callback('')
|
||||
|
||||
} else if (passwd==null) {
|
||||
|
||||
// Request password
|
||||
password.getDialog(albumID, callback);
|
||||
password.getDialog(albumID, callback)
|
||||
|
||||
} else {
|
||||
|
||||
// Check password
|
||||
|
||||
params = {
|
||||
let params = {
|
||||
albumID,
|
||||
password: passwd
|
||||
}
|
||||
@ -39,14 +37,14 @@ password.get = function(albumID, callback, passwd) {
|
||||
api.post('Album::getPublic', params, function(data) {
|
||||
|
||||
if (data===true) {
|
||||
basicModal.close();
|
||||
password.value = passwd;
|
||||
callback();
|
||||
basicModal.close()
|
||||
password.value = passwd
|
||||
callback()
|
||||
} else {
|
||||
basicModal.error('password');
|
||||
basicModal.error('password')
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@ -54,18 +52,14 @@ password.get = function(albumID, callback, passwd) {
|
||||
|
||||
password.getDialog = function(albumID, callback) {
|
||||
|
||||
var action,
|
||||
cancel,
|
||||
msg = '';
|
||||
const action = (data) => password.get(albumID, callback, data.password)
|
||||
|
||||
action = function(data) { password.get(albumID, callback, data.password) }
|
||||
|
||||
cancel = function() {
|
||||
basicModal.close();
|
||||
if (visible.albums()===false) lychee.goto();
|
||||
const cancel = () => {
|
||||
basicModal.close()
|
||||
if (visible.albums()===false) lychee.goto()
|
||||
}
|
||||
|
||||
msg = `
|
||||
let msg = `
|
||||
<p>
|
||||
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=''>
|
||||
@ -84,6 +78,6 @@ password.getDialog = function(albumID, callback) {
|
||||
fn: cancel
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user