New modal for password.getDialog
This commit is contained in:
parent
20bcac4dd2
commit
42b4d60b13
@ -11,7 +11,7 @@ password = {
|
||||
|
||||
password.get = function(albumID, callback) {
|
||||
|
||||
var passwd = $('.message input.text').val(),
|
||||
var passwd = $('.basicModal input.text').val(),
|
||||
params;
|
||||
|
||||
if (!lychee.publicMode) callback();
|
||||
@ -35,11 +35,11 @@ password.get = function(albumID, callback) {
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data===true) {
|
||||
basicModal.close();
|
||||
password.value = md5(passwd);
|
||||
callback();
|
||||
} else {
|
||||
lychee.goto('');
|
||||
loadingBar.show('error', 'Access denied. Wrong password!');
|
||||
basicModal.error('password');
|
||||
}
|
||||
|
||||
});
|
||||
@ -50,12 +50,36 @@ password.get = function(albumID, callback) {
|
||||
|
||||
password.getDialog = function(albumID, callback) {
|
||||
|
||||
var buttons;
|
||||
var action,
|
||||
cancel,
|
||||
msg = '';
|
||||
|
||||
buttons = [
|
||||
['Enter', function() { password.get(albumID, callback) }],
|
||||
['Cancel', lychee.goto]
|
||||
];
|
||||
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);
|
||||
action = function() { password.get(albumID, callback) }
|
||||
|
||||
cancel = function() {
|
||||
basicModal.close();
|
||||
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