Show error when adding new user which already exists

This commit is contained in:
Sílvio Soares Ribeiro Júnior
2011-04-07 11:29:10 +02:00
committed by Michal Čihař
parent 32b9a47a55
commit 288329402c

View File

@@ -890,6 +890,7 @@ if (isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) {
$message = PMA_Message::error(__('The user %s already exists!')); $message = PMA_Message::error(__('The user %s already exists!'));
$message->addParam('[i]\'' . $username . '\'@\'' . $hostname . '\'[/i]'); $message->addParam('[i]\'' . $username . '\'@\'' . $hostname . '\'[/i]');
$_REQUEST['adduser'] = true; $_REQUEST['adduser'] = true;
$_add_user_error = true;
} else { } else {
$create_user_real = 'CREATE USER \'' . PMA_sqlAddslashes($username) . '\'@\'' . PMA_sqlAddslashes($hostname) . '\''; $create_user_real = 'CREATE USER \'' . PMA_sqlAddslashes($username) . '\'@\'' . PMA_sqlAddslashes($hostname) . '\'';
@@ -1385,7 +1386,7 @@ $link_export = '<a class="export_user_anchor ' . $conditional_class . '" href="s
* If we are in an Ajax request for Create User/Edit User/Revoke User/Flush Privileges, * If we are in an Ajax request for Create User/Edit User/Revoke User/Flush Privileges,
* show $message and exit. * show $message and exit.
*/ */
if( $GLOBALS['is_ajax_request'] && !isset($_REQUEST['export']) && !isset($_REQUEST['adduser']) && !isset($_REQUEST['initial']) && !isset($_REQUEST['showall']) && !isset($_REQUEST['edit_user_dialog'])) { if( $GLOBALS['is_ajax_request'] && !isset($_REQUEST['export']) && (!isset($_REQUEST['adduser']) || $_add_user_error) && !isset($_REQUEST['initial']) && !isset($_REQUEST['showall']) && !isset($_REQUEST['edit_user_dialog'])) {
if(isset($sql_query)) { if(isset($sql_query)) {
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query); $extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);