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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dicson
gajim
Commits
2be4b0a5
Commit
2be4b0a5
authored
Jan 23, 2017
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'master'
Improvements for windows keyring storage See merge request !38
parents
ca3b5eee
f59fd73f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
22 deletions
+29
-22
src/common/config.py
src/common/config.py
+1
-0
src/common/passwords.py
src/common/passwords.py
+26
-20
src/features_window.py
src/features_window.py
+2
-2
No files found.
src/common/config.py
View file @
2be4b0a5
...
...
@@ -314,6 +314,7 @@ class Config:
'remember_opened_chat_controls'
:
[
opt_bool
,
True
,
_
(
'If enabled, Gajim will reopen chat windows that were opened last time Gajim was closed.'
)],
'positive_184_ack'
:
[
opt_bool
,
False
,
_
(
'If enabled, Gajim will show an icon to show that sent message has been received by your contact'
)],
'show_avatar_in_tabs'
:
[
opt_bool
,
False
,
_
(
'Show a mini avatar in chat window tabs and in window icon'
)],
'use_keyring'
:
[
opt_bool
,
True
,
_
(
'If True, Gajim will use the Systems Keyring to store account passwords.'
)],
},
{})
__options_per_key
=
{
...
...
src/common/passwords.py
View file @
2be4b0a5
...
...
@@ -52,7 +52,7 @@ class PasswordStorage(object):
class
SimplePasswordStorage
(
PasswordStorage
):
def
get_password
(
self
,
account_name
):
passwd
=
gajim
.
config
.
get_per
(
'accounts'
,
account_name
,
'password'
)
if
passwd
and
passwd
.
startswith
(
'libsecret:'
):
if
passwd
and
(
passwd
.
startswith
(
'libsecret:'
)
or
passwd
.
startswith
(
'winvault:'
)
):
# this is not a real password, it’s stored through libsecret.
return
None
else
:
...
...
@@ -116,8 +116,14 @@ class SecretWindowsPasswordStorage(PasswordStorage):
self
.
win_keyring
=
keyring
.
get_keyring
()
def
save_password
(
self
,
account_name
,
password
):
try
:
self
.
win_keyring
.
set_password
(
'gajim'
,
account_name
,
password
)
gajim
.
config
.
set_per
(
'accounts'
,
account_name
,
'password'
,
'winvault:'
)
gajim
.
config
.
set_per
(
'accounts'
,
account_name
,
'password'
,
'winvault:'
)
except
:
log
.
exception
(
'error:'
)
set_storage
(
SimplePasswordStorage
())
storage
.
save_password
(
account_name
,
password
)
def
get_password
(
self
,
account_name
):
log
.
debug
(
'getting password'
)
...
...
@@ -127,10 +133,7 @@ class SecretWindowsPasswordStorage(PasswordStorage):
if
not
conf
.
startswith
(
'winvault:'
):
password
=
conf
# migrate the password over to keyring
try
:
self
.
save_password
(
account_name
,
password
)
except
Exception
:
log
.
exception
(
'error: '
)
return
password
return
self
.
win_keyring
.
get_password
(
'gajim'
,
account_name
)
...
...
@@ -140,6 +143,7 @@ def get_storage():
global
storage
if
storage
is
None
:
# None is only in first time get_storage is called
global
Secret
if
gajim
.
config
.
get
(
'use_keyring'
):
try
:
gi
.
require_version
(
'Secret'
,
'1'
)
gir
=
__import__
(
'gi.repository'
,
globals
(),
locals
(),
...
...
@@ -154,6 +158,8 @@ def get_storage():
storage
=
SecretWindowsPasswordStorage
()
except
Exception
:
storage
=
SimplePasswordStorage
()
else
:
storage
=
SimplePasswordStorage
()
return
storage
def
set_storage
(
storage_
):
...
...
src/features_window.py
View file @
2be4b0a5
...
...
@@ -69,7 +69,7 @@ class FeaturesWindow:
_
(
'Password encryption'
):
(
self
.
some_keyring_available
,
_
(
'Passwords can be stored securely and not just in plaintext.'
),
_
(
'Requires libsecret and a provider (such as GNOME Keyring and KSecretService).'
),
_
(
'
Feature not available under Windows
.'
)),
_
(
'
On Windows the Windows Credential Vault is used
.'
)),
_
(
'Spell Checker'
):
(
self
.
speller_available
,
_
(
'Spellchecking of composed messages.'
),
_
(
'Requires libgtkspell.'
),
...
...
@@ -183,7 +183,7 @@ class FeaturesWindow:
def
some_keyring_available
(
self
):
if
os
.
name
==
'nt'
:
return
Fals
e
return
Tru
e
try
:
gi
.
require_version
(
'Secret'
,
'1'
)
from
gi.repository
import
Secret
...
...
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