Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
tails
tails
Commits
10483e8a
Commit
10483e8a
authored
Jun 27, 2020
by
segfault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce AdminSettingUI.use_saved_password (refs:
#17136
)
parent
261788dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py
...hon3/dist-packages/tailsgreeter/ui/additional_settings.py
+14
-10
No files found.
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py
View file @
10483e8a
...
...
@@ -69,7 +69,7 @@ class AdminSettingUI(AdditionalSetting):
@
property
def
value_for_display
(
self
)
->
str
:
return
get_on_off_string
(
self
.
password
,
default
=
None
)
return
get_on_off_string
(
self
.
new_password
or
self
.
use_saved_
password
,
default
=
None
)
def
update_check_icon
(
self
):
password
=
self
.
password_entry
.
get_text
()
...
...
@@ -89,7 +89,8 @@ class AdminSettingUI(AdditionalSetting):
def
__init__
(
self
,
admin_setting
:
"AdminSetting"
):
self
.
_admin_setting
=
admin_setting
self
.
password
=
None
self
.
new_password
=
""
self
.
use_saved_password
=
False
super
().
__init__
()
self
.
accel_key
=
Gdk
.
KEY_a
...
...
@@ -110,7 +111,7 @@ class AdminSettingUI(AdditionalSetting):
def
cb_popover_opened
(
self
,
popover
,
user_data
=
None
):
self
.
password_verify_entry
.
set_icon_from_icon_name
(
Gtk
.
EntryIconPosition
.
SECONDARY
,
None
)
password_already_set
=
bool
(
self
.
password
)
password_already_set
=
bool
(
self
.
new_
password
)
or
self
.
use_saved_password
self
.
box_admin_password
.
set_visible
(
not
password_already_set
)
self
.
box_admin_verify
.
set_visible
(
not
password_already_set
)
self
.
button_admin_disable
.
set_visible
(
password_already_set
)
...
...
@@ -123,15 +124,15 @@ class AdminSettingUI(AdditionalSetting):
return
password
==
self
.
password_verify_entry
.
get_text
()
def
apply
(
self
):
if
self
.
password
is
True
:
if
self
.
use_saved_
password
:
# This should only be the case if the persistent storage was
# unlocked and a persistent password settings file was found.
# In that case, we just want to keep the existing settings file.
pass
elif
self
.
password
:
elif
self
.
new_
password
:
# Write the password to a file from which it will be set
# as the amnesia password when the greeter is closed.
self
.
_admin_setting
.
save
(
self
.
password
)
self
.
_admin_setting
.
save
(
self
.
new_
password
)
else
:
self
.
_admin_setting
.
delete
()
super
().
apply
()
...
...
@@ -141,14 +142,15 @@ class AdminSettingUI(AdditionalSetting):
self
.
_admin_setting
.
load
()
except
SettingNotFoundError
:
raise
self
.
password
=
True
self
.
use_saved_
password
=
True
return
True
def
cb_entry_admin_changed
(
self
,
editable
,
user_data
=
None
):
self
.
update_check_icon
()
passwords_match
=
self
.
passwords_match
()
if
passwords_match
:
self
.
password
=
self
.
password_entry
.
get_text
()
self
.
new_password
=
self
.
password_entry
.
get_text
()
self
.
use_saved_password
=
False
if
self
.
dialog
:
self
.
dialog
.
button_add
.
set_sensitive
(
passwords_match
)
return
False
...
...
@@ -160,12 +162,14 @@ class AdminSettingUI(AdditionalSetting):
self
.
password_verify_entry
.
grab_focus
()
return
False
self
.
password
=
self
.
password_entry
.
get_text
()
self
.
new_password
=
self
.
password_entry
.
get_text
()
self
.
use_saved_password
=
False
self
.
close_window
(
Gtk
.
ResponseType
.
YES
)
return
False
def
cb_button_admin_disable_clicked
(
self
,
widget
,
user_data
=
None
):
self
.
password
=
None
self
.
new_password
=
None
self
.
use_saved_password
=
False
self
.
password_entry
.
set_text
(
""
)
self
.
password_verify_entry
.
set_text
(
""
)
...
...
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