Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gajim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
208
Issues
208
List
Boards
Labels
Service Desk
Milestones
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim
Commits
5b9c564f
Commit
5b9c564f
authored
Dec 01, 2018
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better handle not available keyring backends
parent
108b0878
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
gajim/common/passwords.py
gajim/common/passwords.py
+15
-3
No files found.
gajim/common/passwords.py
View file @
5b9c564f
...
...
@@ -31,6 +31,7 @@
try
:
import
keyring
from
keyring.core
import
recommended
KEYRING_AVAILABLE
=
True
except
ImportError
:
KEYRING_AVAILABLE
=
False
...
...
@@ -53,6 +54,7 @@ class SecretPasswordStorage(PasswordStorage):
def
__init__
(
self
):
self
.
keyring
=
keyring
.
get_keyring
()
log
.
info
(
'Chose %s backend'
,
self
.
keyring
)
def
save_password
(
self
,
account_name
,
password
):
try
:
...
...
@@ -83,10 +85,20 @@ def __init__(self):
def
connect_backends
(
self
):
"""Initialize backend connections, determining which ones are available.
"""
# TODO: handle disappearing backends
if
app
.
config
.
get
(
'use_keyring'
)
and
KEYRING_AVAILABLE
:
self
.
secret
=
SecretPasswordStorage
()
if
not
app
.
config
.
get
(
'use_keyring'
)
or
not
KEYRING_AVAILABLE
:
return
backends
=
keyring
.
backend
.
get_all_keyring
()
for
backend
in
backends
:
log
.
info
(
'Found keyring backend: %s'
,
backend
)
for
backend
in
backends
:
if
recommended
(
backend
):
self
.
secret
=
SecretPasswordStorage
()
return
log
.
warning
(
'No recommended keyring backend found, '
'plain storage is used'
)
def
get_password
(
self
,
account_name
):
pw
=
app
.
config
.
get_per
(
'accounts'
,
account_name
,
'password'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment