mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-30 19:56:14 +01:00
Merge pull request #661 from lethliel/fix_credentials_with_passx
fix credentials with passx entries
This commit is contained in:
commit
78b1e218c0
@ -65,6 +65,8 @@ class AbstractCredentialsManager(object):
|
|||||||
|
|
||||||
class PlaintextConfigFileCredentialsManager(AbstractCredentialsManager):
|
class PlaintextConfigFileCredentialsManager(AbstractCredentialsManager):
|
||||||
def get_password(self, url, user, defer=True):
|
def get_password(self, url, user, defer=True):
|
||||||
|
if self._cp.has_option(url, 'passx', proper=True):
|
||||||
|
return self._cp.get(url, 'passx', raw=True)
|
||||||
return self._cp.get(url, 'pass', raw=True)
|
return self._cp.get(url, 'pass', raw=True)
|
||||||
|
|
||||||
def set_password(self, url, user, password):
|
def set_password(self, url, user, password):
|
||||||
@ -101,6 +103,10 @@ class ObfuscatedConfigFileCredentialsManager(
|
|||||||
password = base64.b64encode(compressed_pw).decode("ascii")
|
password = base64.b64encode(compressed_pw).decode("ascii")
|
||||||
super(self.__class__, self).set_password(url, user, password)
|
super(self.__class__, self).set_password(url, user, password)
|
||||||
|
|
||||||
|
def delete_password(self, url, user):
|
||||||
|
self._cp.remove_option(url, 'passx')
|
||||||
|
super(self.__class__, self).delete_password(url, user)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def decode_password(cls, password):
|
def decode_password(cls, password):
|
||||||
compressed_pw = base64.b64decode(password.encode("ascii"))
|
compressed_pw = base64.b64decode(password.encode("ascii"))
|
||||||
|
Loading…
Reference in New Issue
Block a user