mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-27 01:54:06 +00:00
Fix minor authentication bugs...
1. User not prompted to save corrected mb server because port is passed as -1 2. If user changes userid or password, reload collections 3. If user clears userid or password, clear collections.
This commit is contained in:
@@ -101,3 +101,5 @@ def load_user_collections(callback=None):
|
||||
|
||||
if config.setting["username"] and config.setting["password"]:
|
||||
tagger.xmlws.get_collection_list(partial(request_finished))
|
||||
else:
|
||||
user_collections = {}
|
||||
|
||||
@@ -22,6 +22,7 @@ from picard.ui.options import OptionsPage, register_options_page
|
||||
from picard.ui.ui_options_general import Ui_GeneralOptionsPage
|
||||
from picard.util import rot13
|
||||
from picard.const import MUSICBRAINZ_SERVERS
|
||||
from picard.collection import load_user_collections
|
||||
|
||||
|
||||
class GeneralOptionsPage(OptionsPage):
|
||||
@@ -58,9 +59,13 @@ class GeneralOptionsPage(OptionsPage):
|
||||
def save(self):
|
||||
config.setting["server_host"] = unicode(self.ui.server_host.currentText()).strip()
|
||||
config.setting["server_port"] = self.ui.server_port.value()
|
||||
reloadCollections = config.setting["username"] != unicode(self.ui.username.text()) \
|
||||
or config.setting["password"] != unicode(self.ui.password.text())
|
||||
config.setting["username"] = unicode(self.ui.username.text())
|
||||
# trivially encode the password, just to not make it so apparent
|
||||
config.setting["password"] = rot13(unicode(self.ui.password.text()))
|
||||
if reloadCollections:
|
||||
load_user_collections()
|
||||
config.setting["analyze_new_files"] = self.ui.analyze_new_files.isChecked()
|
||||
config.setting["ignore_file_mbids"] = self.ui.ignore_file_mbids.isChecked()
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class PasswordDialog(QtGui.QDialog):
|
||||
self.ui.setupUi(self)
|
||||
self.ui.info_text.setText(_("The server %s requires you to login. Please enter your username and password.") % reply.url().host())
|
||||
# TODO: Implement proper password storage for arbitrary servers
|
||||
if self._is_musicbrainz_server(reply.url().host(), reply.url().port()):
|
||||
if self._is_musicbrainz_server(reply.url().host()):
|
||||
self.ui.save_authentication.setChecked(config.persist["save_authentication"])
|
||||
self.ui.username.setText(config.setting["username"])
|
||||
self.ui.password.setText(config.setting["password"])
|
||||
@@ -56,8 +56,8 @@ class PasswordDialog(QtGui.QDialog):
|
||||
self._authenticator.setPassword(unicode(self.ui.password.text()))
|
||||
self.accept()
|
||||
|
||||
def _is_musicbrainz_server(self, host, port):
|
||||
return host == config.setting["server_host"] and port == config.setting["server_port"]
|
||||
def _is_musicbrainz_server(self, host):
|
||||
return host == config.setting["server_host"]
|
||||
|
||||
|
||||
class ProxyDialog(QtGui.QDialog):
|
||||
|
||||
Reference in New Issue
Block a user