New modal for password.getDialog
This commit is contained in:
parent
20bcac4dd2
commit
42b4d60b13
@ -11,7 +11,7 @@ password = {
|
|||||||
|
|
||||||
password.get = function(albumID, callback) {
|
password.get = function(albumID, callback) {
|
||||||
|
|
||||||
var passwd = $('.message input.text').val(),
|
var passwd = $('.basicModal input.text').val(),
|
||||||
params;
|
params;
|
||||||
|
|
||||||
if (!lychee.publicMode) callback();
|
if (!lychee.publicMode) callback();
|
||||||
@ -35,11 +35,11 @@ password.get = function(albumID, callback) {
|
|||||||
lychee.api(params, function(data) {
|
lychee.api(params, function(data) {
|
||||||
|
|
||||||
if (data===true) {
|
if (data===true) {
|
||||||
|
basicModal.close();
|
||||||
password.value = md5(passwd);
|
password.value = md5(passwd);
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
lychee.goto('');
|
basicModal.error('password');
|
||||||
loadingBar.show('error', 'Access denied. Wrong password!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -50,12 +50,36 @@ password.get = function(albumID, callback) {
|
|||||||
|
|
||||||
password.getDialog = function(albumID, callback) {
|
password.getDialog = function(albumID, callback) {
|
||||||
|
|
||||||
var buttons;
|
var action,
|
||||||
|
cancel,
|
||||||
|
msg = '';
|
||||||
|
|
||||||
buttons = [
|
action = function() { password.get(albumID, callback) }
|
||||||
['Enter', function() { password.get(albumID, callback) }],
|
|
||||||
['Cancel', lychee.goto]
|
cancel = function() {
|
||||||
];
|
basicModal.close();
|
||||||
modal.show("<a class='icon-lock'></a> Enter Password", "This album is protected by a password. Enter the password below to view the photos of this album: <input class='text' type='password' placeholder='password' value=''>", buttons, -110, false);
|
lychee.goto();
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = `
|
||||||
|
<p>
|
||||||
|
This album is protected by a password. Enter the password below to view the photos of this album:
|
||||||
|
<input data-name='password' class='text' type='password' placeholder='password' value=''>
|
||||||
|
</p>
|
||||||
|
`
|
||||||
|
|
||||||
|
basicModal.show({
|
||||||
|
body: msg,
|
||||||
|
buttons: {
|
||||||
|
action: {
|
||||||
|
title: 'Enter',
|
||||||
|
fn: action
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
title: 'Cancel',
|
||||||
|
fn: cancel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user