Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] r58172 - in /trunk/storage/storage/src: include/ep-dialogs.ycp modules/Storage.ycp
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Mon, 27 Jul 2009 14:00:30 -0000
  • Message-id: <E1MVQkg-0002mU-PS@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Mon Jul 27 16:00:30 2009
New Revision: 58172

URL: http://svn.opensuse.org/viewcvs/yast?rev=58172&view=rev
Log:
- moved code to check passwords for encryption to separate function

Modified:
trunk/storage/storage/src/include/ep-dialogs.ycp
trunk/storage/storage/src/modules/Storage.ycp

Modified: trunk/storage/storage/src/include/ep-dialogs.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-dialogs.ycp?rev=58172&r1=58171&r2=58172&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-dialogs.ycp (original)
+++ trunk/storage/storage/src/include/ep-dialogs.ycp Mon Jul 27 16:00:30 2009
@@ -503,9 +503,7 @@
MiniWorkflow::SetContents(Greasemonkey::Transform(contents),
MiniWorkflowStepPasswordHelptext(data));
MiniWorkflow::SetLastStep(true);

- string pw1 = "";
- string pw2 = "";
-
+ string password = "";
symbol widget = nil;

//don't put those inside the loop - they'd be reset after each
unsuccesful try
@@ -518,47 +516,14 @@

if (widget == `next)
{
- pw1 = (string) UI::QueryWidget(`id(`pw1), `Value);
- pw2 = (string) UI::QueryWidget(`id(`pw2), `Value);
+ password = (string) UI::QueryWidget(`id(`pw1), `Value);
+ string tmp = (string) UI::QueryWidget(`id(`pw2), `Value);

- if ( pw1 != pw2 )
- {
- // popup text
- Popup::Message(_("The first and the second version\nof the
password do not match!\nPlease try again."));
- UI::SetFocus(`id(`pw1) );
- widget = `again;
- }
- else if (pw1 == "" && !empty_pw_allowed)
- {
- // popup text
- Popup::Message(_("You did not enter a password.
-Try again.
-"));
- UI::SetFocus(`id(`pw1) );
- widget = `again;
- }
- else if (size(pw1) < min_pw_len && !empty_pw_allowed)
+ if (!Storage::CheckEncryptionPasswords(password, tmp,
min_pw_len, empty_pw_allowed))
{
- // popup text
- Popup::Message(sformat(_("The password must have at least
%1 characters.
-Try again.
-"), min_pw_len));
UI::SetFocus(`id(`pw1) );
widget = `again;
}
- else if (size(pw1) >= min_pw_len || empty_pw_allowed)
- {
- any ret2 = findfirstnotof( pw1,
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#*
,.;:._-+!$%&/|\?{[()]}@^\\<>" );
- if ( ret2 != nil && size(pw1)>0 )
- {
- // popup text
- Popup::Message(_("The password may only contain the
following characters:
-0..9, a..z, A..Z, and any of \"@#* ,.;:._-+!$%&/|\?{[()]}^\\<>\".
-Try again."));
- UI::SetFocus(`id(`pw1) );
- widget = `again;
- }
- }
}
}
until (widget == `abort || widget == `back || widget == `next);
@@ -566,9 +531,9 @@
if (widget == `next)
{
if (data["type"]:`unknown != `loop)
- Storage::UpdateClassified(data["device"]:"", pw1);
+ Storage::UpdateClassified(data["device"]:"", password);
else
- Storage::UpdateClassified(data["fpath"]:"", pw1);
+ Storage::UpdateClassified(data["fpath"]:"", password);
widget = `finish;
}


Modified: trunk/storage/storage/src/modules/Storage.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=58172&r1=58171&r2=58172&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Mon Jul 27 16:00:30 2009
@@ -5786,4 +5786,48 @@
}


+ global boolean CheckEncryptionPasswords(string pw1, string pw2, integer
min_length, boolean empty_allowed)
+ {
+ if (pw1 != pw2)
+ {
+ // popup text
+ Popup::Message(_("The first and the second version\nof the password
do not match.
+Try again."));
+ return false;
+ }
+
+ if (isempty(pw1) && !empty_allowed)
+ {
+ // popup text
+ Popup::Message(_("You did not enter a password.
+Try again.
+"));
+ return false;
+ }
+
+ if (size(pw1) < min_length && !empty_allowed)
+ {
+ // popup text
+ Popup::Message(sformat(_("The password must have at least %1
characters.
+Try again.
+"), min_length));
+ return false;
+ }
+
+ if (size(pw1) >= min_length || empty_allowed)
+ {
+ any tmp = findfirstnotof( pw1,
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#*
,.;:._-+!$%&/|\?{[()]}@^\\<>" );
+ if (tmp != nil && size(pw1) > 0)
+ {
+ // popup text
+ Popup::Message(_("The password may only contain the following
characters:
+ 0..9, a..z, A..Z, and any of \"@#* ,.;:._-+!$%&/|\?{[()]}^\\<>\".
+Try again."));
+ return false;
+ }
+ }
+
+ return true;
+ }
+
}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages