Changeset View
Changeset View
Standalone View
Standalone View
scripts/user/account_admin.php
| Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | do { | ||||
| } else { | } else { | ||||
| break; | break; | ||||
| } | } | ||||
| } while (true); | } while (true); | ||||
| $create_email = $email; | $create_email = $email; | ||||
| } | } | ||||
| $changed_pass = false; | |||||
| // This disables local echo, so the user's password is not shown as they type | |||||
| // it. | |||||
| phutil_passthru('stty -echo'); | |||||
| $password = phutil_console_prompt( | |||||
| pht('Enter a password for this user [blank to leave unchanged]:')); | |||||
| phutil_passthru('stty echo'); | |||||
| if (strlen($password)) { | |||||
| $changed_pass = $password; | |||||
| } | |||||
| $is_system_agent = $user->getIsSystemAgent(); | $is_system_agent = $user->getIsSystemAgent(); | ||||
| $set_system_agent = phutil_console_confirm( | $set_system_agent = phutil_console_confirm( | ||||
| pht('Is this user a bot?'), | pht('Is this user a bot?'), | ||||
| $default_no = !$is_system_agent); | $default_no = !$is_system_agent); | ||||
| $verify_email = null; | $verify_email = null; | ||||
| $set_verified = false; | $set_verified = false; | ||||
| // Allow administrators to verify primary email addresses at this time in edit | // Allow administrators to verify primary email addresses at this time in edit | ||||
| Show All 19 Lines | |||||
| echo "\n\n".pht('ACCOUNT SUMMARY')."\n\n"; | echo "\n\n".pht('ACCOUNT SUMMARY')."\n\n"; | ||||
| $tpl = "%12s %-30s %-30s\n"; | $tpl = "%12s %-30s %-30s\n"; | ||||
| printf($tpl, null, pht('OLD VALUE'), pht('NEW VALUE')); | printf($tpl, null, pht('OLD VALUE'), pht('NEW VALUE')); | ||||
| printf($tpl, pht('Username'), $original->getUsername(), $user->getUsername()); | printf($tpl, pht('Username'), $original->getUsername(), $user->getUsername()); | ||||
| printf($tpl, pht('Real Name'), $original->getRealName(), $user->getRealName()); | printf($tpl, pht('Real Name'), $original->getRealName(), $user->getRealName()); | ||||
| if ($is_new) { | if ($is_new) { | ||||
| printf($tpl, pht('Email'), '', $create_email); | printf($tpl, pht('Email'), '', $create_email); | ||||
| } | } | ||||
| printf($tpl, pht('Password'), null, | |||||
| ($changed_pass !== false) | |||||
| ? pht('Updated') | |||||
| : pht('Unchanged')); | |||||
| printf( | printf( | ||||
| $tpl, | $tpl, | ||||
| pht('Bot'), | pht('Bot'), | ||||
| $original->getIsSystemAgent() ? 'Y' : 'N', | $original->getIsSystemAgent() ? 'Y' : 'N', | ||||
| $set_system_agent ? 'Y' : 'N'); | $set_system_agent ? 'Y' : 'N'); | ||||
| if ($verify_email) { | if ($verify_email) { | ||||
| Show All 40 Lines | if ($verify_email) { | ||||
| $verify_email->setIsVerified($set_verified ? 1 : 0); | $verify_email->setIsVerified($set_verified ? 1 : 0); | ||||
| } | } | ||||
| $editor->updateUser($user, $verify_email); | $editor->updateUser($user, $verify_email); | ||||
| } | } | ||||
| $editor->makeAdminUser($user, $set_admin); | $editor->makeAdminUser($user, $set_admin); | ||||
| $editor->makeSystemAgentUser($user, $set_system_agent); | $editor->makeSystemAgentUser($user, $set_system_agent); | ||||
| if ($changed_pass !== false) { | |||||
| $envelope = new PhutilOpaqueEnvelope($changed_pass); | |||||
| $editor->changePassword($user, $envelope); | |||||
| } | |||||
| $user->saveTransaction(); | $user->saveTransaction(); | ||||
| echo pht('Saved changes.')."\n"; | echo pht('Saved changes.')."\n"; | ||||