Author: jsuchome Date: Wed Mar 26 10:58:01 2008 New Revision: 45730 URL: http://svn.opensuse.org/viewcvs/yast?rev=45730&view=rev Log: - check for default values of autologin and "root password = user password" options - check for CA constraints Modified: trunk/users/src/UsersSimple.pm trunk/users/src/inst_user_first.ycp Modified: trunk/users/src/UsersSimple.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/UsersSimple.pm?rev=45730&r1=45729&r2=45730&view=diff ============================================================================== --- trunk/users/src/UsersSimple.pm (original) +++ trunk/users/src/UsersSimple.pm Wed Mar 26 10:58:01 2008 @@ -249,7 +249,6 @@ BEGIN { $TYPEINFO{AutologinUsed} = ["function", "boolean"]; } sub AutologinUsed { return bool ($autologin_user ne ""); -# FIXME true for the first time... } BEGIN { $TYPEINFO{SetAutologinUser} = ["function", "void", "string"]; } Modified: trunk/users/src/inst_user_first.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/inst_user_first.ycp?rev=45730&r1=45729&r2=45730&view=diff ============================================================================== --- trunk/users/src/inst_user_first.ycp (original) +++ trunk/users/src/inst_user_first.ycp Wed Mar 26 10:58:01 2008 @@ -15,6 +15,7 @@ import "Popup"; import "Stage"; import "Package"; + import "ProductFeatures"; import "Progress"; import "Report"; import "String"; @@ -28,6 +29,13 @@ string arch = Arch::architecture (); + boolean check_CA_constraints = + ProductFeatures::GetBooleanFeature ("globals","root_password_ca_check"); + + // minimal pw length for CA-management (F#300438) + integer pw_min_CA = 4; + + // helper function to se package for installation, together with // architecture dependent version void install_package (string package) { @@ -193,8 +201,15 @@ UsersSimple::GetMaxPasswordLength ("local") ) + - UsersSimple::ValidPasswordHelptext () + + UsersSimple::ValidPasswordHelptext (); + + if (check_CA_constraints) + help = help + sformat ( +// additional help text about password +_("<p>If you intend to use this password for creating certificates, +it has to be at least %1 characters long.</p>"), pw_min_CA); + help = help + // help text for main add user dialog _("<p> To ensure that the password was entered correctly, @@ -336,6 +351,22 @@ string cn = user["cn"]:""; string password = (string)user["userpassword"]:nil; + boolean autologin = UsersSimple::AutologinUsed (); + // set the initial default value for autologin + if (user == $[] && !autologin) + { + if (ProductFeatures::GetBooleanFeature ("globals", "enable_autologin")) + autologin = true; + } + boolean root_pw = (UsersSimple::GetRootPassword () == password); + // set the initial default value for root pw checkbox + if (user == $[] && !root_pw) + { + if (ProductFeatures::GetBooleanFeature ("globals", "root_password_as_first_user")) + root_pw = true; + y2internal ("root_pw default value: %1", root_pw); + } + // this user gets root's mail boolean root_mail = (username != "" && UsersSimple::GetRootAlias () == username); @@ -356,17 +387,14 @@ term optionbox = `VBox ( `Left (`CheckBox (`id (`root_pw), // checkbox label - _("U&se this password for system administrator"), - UsersSimple::GetRootPassword () == password) + _("U&se this password for system administrator"), root_pw) ), `Left ( // checkbox label `CheckBox (`id (`root_mail), _("Receive S&ystem Mail"), root_mail) ), // checkbox label - `Left (`CheckBox (`id (`autologin),_("&Automatic Login"), - UsersSimple::AutologinUsed ()) - ) + `Left (`CheckBox (`id (`autologin), _("&Automatic Login"), autologin)) ); term contents = `HBox ( `HCenter (`HSquash (`VBox ( @@ -480,6 +508,7 @@ // --------------------------------- password checks string pw1 = (string) UI::QueryWidget(`id(`pw1), `Value); string pw2 = (string) UI::QueryWidget(`id(`pw2),`Value); + root_pw = (boolean) UI::QueryWidget (`id (`root_pw),`Value); if (pw1 != pw2) { @@ -500,6 +529,24 @@ continue; } boolean failed = false; + if (root_pw && check_CA_constraints && size (pw1) < pw_min_CA) + { + if (Popup::YesNo (sformat ( +// yes/no popup question, %1 is a number +_("If you intend to create certificates, +the password should have at least %1 characters. +Really use this shorter password?"), pw_min_CA))) + { + // skip other checks for short passwords + ui_map["short"] = 1; + } + else + { + ret = `notnext; + UI::SetFocus (`id (`pw1)); + continue; + } + } do { error_map = UsersSimple::CheckPasswordUI ($[ @@ -540,7 +587,6 @@ "cn" : cn ]; UsersSimple::SetUser (user_map); - boolean root_pw = (boolean) UI::QueryWidget (`id (`root_pw),`Value); UsersSimple::SkipRootPasswordDialog (root_pw); UsersSimple::SetRootPassword (root_pw ? password : ""); UsersSimple::SetAutologinUser ( -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org