Error: org.h2.jdbc.JdbcSQLException: Table "USERS" not found - sonarqube

Hi I am trying to reset admin password. I am using sonarqube 7.1 version. As per the official doumnetation i am using the below update query to reset password.
update users set crypted_password = '88c991e39bb88b94178123a849606905ebf440f5', salt='6522f3c5007ae910ad690bb1bdbf264a34884c6d' where login = 'admin';
but after executing this I am getting the below error and the password has not been reset.
Error: org.h2.jdbc.JdbcSQLException: Table "USERS" not found; SQL statement: update users set crypted_password = '88c991e39bb88b94178123a849606905ebf440f5', salt='6522f3c5007ae910ad690bb1bdbf264a34884c6d' where login = 'admin' [42102-176]
please help me on this.

Related

localhost/joomla = Showing only Error not Work

I am facing the issue of localhost/joomla is not showing login page, just show word Error
I have attached permission details and other corresponding files. Please help me to solve this issue.
Thankyou for your time.
Seems like the database the site it's not connected.
Check your configuration.php (in the root of the site) for this parameters:
public $dbtype = 'mysqli'; // Driver you are using to connect to the MySQL database.
public $host = 'localhost'; // The host for the database. If it's in the same server, it's ok like this.
public $user = 'root'; // Username for the database
public $password = 'root'; // Password of the database
public $db = 'NAME_OF_THE_DATABASE'; // Name of the database.

This page isn't working redirected you too many times

I am trying to use Socialite library in Laravel 5 and Facebook API to create a "login with Facebook" feature. I followed all of the steps in the tutorial and created an app on Facebook developers, but when I click on the login button, it crashes with the error "This page isn't working redirected you too many times." Below is my callback code. Why isn't this working?
public function handleFacebookCallback()
{
try {
$user = Socialite::driver('facebook')->user();
$create['name'] = $user->getName();
$create['email'] = $user->getEmail();
$create['facebook_id'] = $user->getId();
$userModel = new User;
$createdUser = $userModel->addNew($create);
Auth::loginUsingId($createdUser->id);
return redirect()->route('home');
} catch (Exception $e) {
dd($e);
return redirect('auth/facebook');
}
}
You're getting this error message because the code in try block is failing and executing the catch block which is redirecting the request back to the server which is sending it back to the browser over and over. Die and dumping (dd) the exception reveals this error message:
General error: 1364 Field 'password' doesn't have a default value
The "create new user" function isn't working because the database is sending back a fatal error. The database is dying because there is no value for the password in the insert and the table requires it. Which makes sense when you think about it because the user is creating an account via Facebook and not creating a user ID and password.
Making the password column in the user table able to be null fixes this "[x] redirected you too many times" error.

Add one more column on jos_user table in Joomla 3.7

I am developing custom authentication plugin for login in joomla from third party API.
When we login on any Joomla instance with user/password then the user/pass is passed to API get the correct response (like login_id, username, employee_ident, email, common name.) Then Joomla create the user on Joomla and save the response like (username,fullname ,email) on Joomla database. Now ccms auth plugin is working fine.
My requirement is to save one more column on jos_users while user authentication plugin from API. For this I have created the one column employee_ident in jos_user table but am not able to save employee_ident in joomla db on jos_user table.
Here is my code:
$result = $client->call($method, $params);
[0] => Array
(
[login_id] => Frasier.9878
[email_address] => frabc#gmail.com
[position_code_type_ident] => 157
[employee_ident] => 166651
[position_code_department_abbr_name] => executive_management
[position_code_title] => Chief Financial Officer
[hire_date] => 2003-01-20
[common_name] => Frasier Crane
)
if($result)
{
$email_address = isset($result[0][email_address]) ? $result[0][email_address] : $credentials['username']."#test.com";
$response->email = $email_address;
$response->fullname =$result[0][common_name];
$response->employee_ident =$result[0][employee_ident];
$response->username =$credentials['username'];
$response->status = JAuthentication::STATUS_SUCCESS;
$response->error_message = '';
}
You should create a Profile Plugin for this. By default Joomla! has a #__user_profiles table that can hold additional user information.
See this page from JDocs for more information: https://docs.joomla.org/Creating_a_profile_plugin/en
Another example is the core profile plugin:
https://github.com/joomla/joomla-cms/blob/staging/plugins/user/profile/profile.php

select the right database according to input login field

I have 3 login fields (name, pass, company id). Now when user clicks "Log me in" button CI should select and work with database according to company id (and check user in this database and when he is logged in, work with this database over whole session /each company has its own database/).
How can I do this?
I found this but it looks like it is not the right solution.
Many thanks
CodeIgniter: Connection to your Database
Maybe the link above will help you out.
You have to set a new db connection for the specific company. In CodeIgniter it is really simple.
Combine it with THIS PROBLEM to get access to the database settings setted in the database-config.
Example:
<?php
$config = array();
$config['hostname'] = $this->db->hostname;
$config['username'] = $this->db->username;
$config['password'] = $this->db->password;
$config['database'] = 'companydb';
$config['dbdriver'] = $this->db->dbdriver;
$companydb = $this->load->database($config);
$companydb->query('SELECT ... FROM ... WHERE ...');
?>

How we can give permission to a user to create database in phpmyadmin(cPanel)?

I have a database and a user which is created through cpanel(i have added that user to that database and i am able to access that database using that user and its password. i have given all privileges to that user through cPanel(by clicking on the username in 'current database' table in cpanel and clicking on all privileges check box ).
In my application(which is created using PHP- Codeigniter framework) i want to create new database and tables in that database as per users requirement. For that i am using Codeigniter dbforge class for creating database and the tables in that.
$this->load->dbforge();
if ($this->dbforge->create_database($database_name)){
$config['hostname'] = "localhost";
$config['username'] = "user_name";
$config['password'] = "users_password";
$config['database'] = $database_name;
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = TRUE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";
$config['swap_pre'] = '';
$config['autoinit'] = TRUE;
$config['stricton'] = FALSE;
$db_new=$this->load->database($config,TRUE);
$this->db=$db_new;
$this->load->dbforge();
$fields=array(
'id'=>array('type'=>'INT','auto_increment'=>TRUE,'constraint'=>'5'),
'first_name'=>array('type'=>'VARCHAR','constraint'=>'60'),
'last_name'=>array('type'=>'VARCHAR','constraint'=>'60','null' => TRUE),
);
$this->dbforge->add_field($fields);
$this->dbforge->add_key('id',TRUE);
$this->dbforge->create_table('clients');
}
In the above code i am creating a database first and then loading that database as the current database . This code works perfectly in local host WAMP server but when i uploaded it to the server and then tried to create the database it gives the following Error
Error No 1044: Access denied for user 'username'#'localhost' to database 'database_name'
The line of code which caused thr error is
if ($this->dbforge->create_database($database_name)){
*In that database config setting shown in the above code the 'username' and 'password' is given as the username and password of the already existing database(which is created through cPanel) . Is that the problem...?* .
the current user using which we are trying to create new database is having all the avilable privileges. but in that 'CREATE DATABASE ' privilege is not there.
For database naming I have used the ' prefix_ ' in the database name(CPanel database naming format)
How can i create the database using dbforge class and access to that database using a existing user ...?
Try Create a Super User first
mysql > GRANT ALL PRIVILEGES on databasename.* TO "username"#"localhost" IDENTIFIED BY "password";

Resources