Re: [Tails-dev] #5594: tails-greeter: better administration …

Borrar esta mensaxe

Responder a esta mensaxe
Autor: Andres Gomez Ramirez
Data:  
Para: The Tails public development discussion list
Temas novos: Re: [Tails-dev] #5594: tails-greeter: better administration password UI
Asunto: Re: [Tails-dev] #5594: tails-greeter: better administration password UI
Hi,

> Do you think you could rebase your patch on top of the "wheezy" branch
> of the greeter, and test it in an (experimental) Wheezy-based ISO?
> You can download such an ISO on
> http://nightly.tails.boum.org/build_Tails_ISO_feature-wheezy/


yes, done.

Cheers,

kuronoFrom d5461b9a5f9d49895c631f8116370b0ed4cae656 Mon Sep 17 00:00:00 2001
From: kurono <andres.gomez@???>
Date: Sun, 30 Mar 2014 19:17:25 +0200
Subject: [PATCH] Fix for 5594: tails-greeter: better administration password
UI

---
 glade/optionswindow.glade     |   47 ++++++++++++++++++++++++++++++++++++++---
 tailsgreeter/optionswindow.py |   18 ++++++++++------
 2 files changed, 55 insertions(+), 10 deletions(-)


diff --git a/glade/optionswindow.glade b/glade/optionswindow.glade
index 8725fb8..27f9771 100644
--- a/glade/optionswindow.glade
+++ b/glade/optionswindow.glade
@@ -219,12 +219,12 @@ Otherwise it will be disabled for better security.</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkHBox" id="warning_area">
+                              <object class="GtkHBox" id="warning_area_empty">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkImage" id="warning_image">
+                                  <object class="GtkImage" id="warning_image_empty">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="stock">gtk-dialog-warning</property>
@@ -237,7 +237,48 @@ Otherwise it will be disabled for better security.</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkLabel" id="warning_label">
+                                  <object class="GtkLabel" id="warning_label_empty">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">0</property>
+                                    <property name="xpad">10</property>
+                                    <property name="ypad">10</property>
+                                    <property name="label" translatable="yes">&lt;i&gt;Password must not be empty&lt;/i&gt;</property>
+                                    <property name="use_markup">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHBox" id="warning_area_match">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">6</property>
+                                <child>
+                                  <object class="GtkImage" id="warning_image_match">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="stock">gtk-dialog-warning</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="warning_label_match">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
diff --git a/tailsgreeter/optionswindow.py b/tailsgreeter/optionswindow.py
index af60d53..6bb1af5 100644
--- a/tailsgreeter/optionswindow.py
+++ b/tailsgreeter/optionswindow.py
@@ -38,8 +38,8 @@ class OptionsWindow(TranslatableWindow):
         builder.connect_signals(self)
         self.entry_password = builder.get_object("password_entry")
         self.entry_password2 = builder.get_object("password_entry2")
-        self.warning_label = builder.get_object("warning_label")
-        self.warning_area = builder.get_object("warning_area")
+        self.warning_area_empty = builder.get_object("warning_area_empty")
+        self.warning_area_match = builder.get_object("warning_area_match")
         self.camouflage_checkbox = builder.get_object("camouflage_checkbox")
         self.macspoof_checkbox = builder.get_object("macspoof_checkbox")
         self.macspoof_checkbox.set_active(True)
@@ -54,7 +54,8 @@ class OptionsWindow(TranslatableWindow):
         self.entry_password2.set_visibility(False)


         def cb_pw_changed(*args):
-            self.warning_area.hide()
+            self.warning_area_empty.hide()
+            self.warning_area_match.hide()
             # compact the window
             self.window.resize(1, 1)


@@ -115,10 +116,13 @@ class OptionsWindow(TranslatableWindow):
         """Validate the selected options"""
         auth_password = self.entry_password.get_text()
         test_password = self.entry_password2.get_text()
-        passwords_match = test_password == auth_password
-        if not passwords_match:
-            self.warning_area.show()
-        return passwords_match
+        if len(auth_password) == 0 or len(test_password) == 0:
+            self.warning_area_empty.show()
+            return False
+        elif not auth_password == test_password:
+            self.warning_area_match.show()
+            return False
+        return True


     def set_options_and_login(self):
         """Activate the selected options if they are valid"""
-- 
1.7.9.5