Translated using Weblate (Filipino)
[phpmyadmin.git] / user_password.php
blobe51f887f9735d1944c093a8f871d05c4b4fe9c5f
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * displays and handles the form where the user can change his password
5 * linked from index.php
7 * @package PhpMyAdmin
8 */
10 use PhpMyAdmin\Display\ChangePassword;
11 use PhpMyAdmin\Message;
12 use PhpMyAdmin\Response;
13 use PhpMyAdmin\UserPassword;
15 /**
16 * Gets some core libraries
18 require_once './libraries/common.inc.php';
20 $response = Response::getInstance();
21 $header = $response->getHeader();
22 $scripts = $header->getScripts();
23 $scripts->addFile('server_privileges.js');
24 $scripts->addFile('vendor/zxcvbn.js');
26 /**
27 * Displays an error message and exits if the user isn't allowed to use this
28 * script
30 if (! $GLOBALS['cfg']['ShowChgPassword']) {
31 $GLOBALS['cfg']['ShowChgPassword'] = $GLOBALS['dbi']->selectDb('mysql');
33 if ($cfg['Server']['auth_type'] == 'config' || ! $cfg['ShowChgPassword']) {
34 Message::error(
35 __('You don\'t have sufficient privileges to be here right now!')
36 )->display();
37 exit;
38 } // end if
40 /**
41 * If the "change password" form has been submitted, checks for valid values
42 * and submit the query or logout
44 if (isset($_REQUEST['nopass'])) {
45 if ($_REQUEST['nopass'] == '1') {
46 $password = '';
47 } else {
48 $password = $_REQUEST['pma_pw'];
50 $change_password_message = UserPassword::setChangePasswordMsg();
51 $msg = $change_password_message['msg'];
52 if (! $change_password_message['error']) {
53 UserPassword::changePassword($password, $msg, $change_password_message);
54 } else {
55 UserPassword::getChangePassMessage($change_password_message);
59 /**
60 * If the "change password" form hasn't been submitted or the values submitted
61 * aren't valid -> displays the form
64 // Displays an error message if required
65 if (isset($msg)) {
66 $msg->display();
67 unset($msg);
70 echo ChangePassword::getHtml('change_pw', $username, $hostname);
71 exit;