fix adding hosts and clearing the form after changing password to _password
This commit is contained in:
parent
0e94c31ca2
commit
3f8ef6c66e
|
@ -52,14 +52,14 @@ Deluge.Connections = {
|
|||
var host = form.items.get('host').getValue();
|
||||
var port = form.items.get('port').getValue();
|
||||
var username = form.items.get('username').getValue();
|
||||
var password = form.items.get('password').getValue();
|
||||
var password = form.items.get('_password').getValue();
|
||||
|
||||
Deluge.Client.web.add_host(host, port, username, password, {
|
||||
onSuccess: function(result) {
|
||||
if (!result) {
|
||||
if (!result[0]) {
|
||||
Ext.MessageBox.show({
|
||||
title: _('Error'),
|
||||
msg: "Unable to add host",
|
||||
msg: "Unable to add host: " + result[1],
|
||||
buttons: Ext.MessageBox.OK,
|
||||
modal: false,
|
||||
icon: Ext.MessageBox.ERROR,
|
||||
|
@ -79,7 +79,7 @@ Deluge.Connections = {
|
|||
form.items.get('host').reset();
|
||||
form.items.get('port').reset();
|
||||
form.items.get('username').reset();
|
||||
form.items.get('password').reset();
|
||||
form.items.get('_password').reset();
|
||||
},
|
||||
|
||||
onClose: function(e) {
|
||||
|
|
|
@ -480,14 +480,20 @@ class WebApi(JSONComponent):
|
|||
# if thats the case
|
||||
for entry in self.host_list["hosts"]:
|
||||
if (entry[0], entry[1], entry[2]) == (host, port, username):
|
||||
d.callback(False)
|
||||
d.callback((False, "Host already in the list"))
|
||||
|
||||
try:
|
||||
port = int(port)
|
||||
except:
|
||||
d.callback((False, "Port is invalid"))
|
||||
return d
|
||||
|
||||
# Host isn't in the list, so lets add it
|
||||
connection_id = hashlib.sha1(str(time.time())).hexdigest()
|
||||
self.host_list["hosts"].append([connection_id, host, port, username,
|
||||
password])
|
||||
self.host_list.save()
|
||||
d.callback(True)
|
||||
d.callback((True,))
|
||||
return d
|
||||
|
||||
@export
|
||||
|
|
Loading…
Reference in New Issue