summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.password
diff options
context:
space:
mode:
Diffstat (limited to 'etc/rc.initial.password')
-rwxr-xr-xetc/rc.initial.password26
1 files changed, 17 insertions, 9 deletions
diff --git a/etc/rc.initial.password b/etc/rc.initial.password
index f92055f..82a3edd 100755
--- a/etc/rc.initial.password
+++ b/etc/rc.initial.password
@@ -41,17 +41,25 @@ The webConfigurator password will be reset to the default (which is "' . strtolo
gettext('Do you want to proceed [y|n]?');
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
-
- foreach ($config['system']['user'] as & $user) {
- if (isset($user['uid']) && !$user['uid']) {
- $user['name'] = "admin";
- set_local_user($user, strtolower($g['product_name']));
- write_config(gettext("password changed from console menu"));
- system_password_configure();
- break;
- }
+ $admin_user =& getUserEntryByUID(0);
+ if (!$admin_user) {
+ echo "Failed to locate the admin user account! Attempting to restore access.\n";
+ $admin_user = array();
+ $admin_user['uid'] = 0;
+ $admin_user['priv'] = explode(",", "user-shell-access,page-all");
+ if (!is_array($config['system']['user']))
+ $config['system']['user'] = array();
+ $config['system']['user'][] = $admin_user;
}
+ $admin_user['name'] = "admin";
+ $admin_user['scope'] = "system";
+ $admin_user['blah'] = "set by console";
+
+ local_user_set_password($admin_user, strtolower($g['product_name']));
+ local_user_set($admin_user);
+ write_config(gettext("password changed from console menu"));
+
echo "\n" . gettext('
The password for the webConfigurator has been reset and
the default username has been set to "admin".') . "\n" .
OpenPOWER on IntegriCloud