KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Dashboard authentication with database #2179

Open Andrea Granzotto opened this topic on on Jul 2, 2021 - 10 comments

Andrea Granzotto commented on Jul 2, 2021

Hello, I can't find in your documentation, how I can manage the user authentication via database. I'd like to store the user credentials in the database and authenticate the user with these.

Rares Biris commented on Aug 12, 2021

Didi you solved this problem?

Andrea Granzotto commented on Aug 12, 2021

Not yet

KoolReport commented on Aug 17, 2021

If you have had a user information in your database, you can use our Login object with authenticate() function to verify user login. We have example in our demo.

It could be that I have not understood fully your need, if so, please let me know

daniel commented on Aug 17, 2021

I have the same problem, the documentations is horrible, how I can use dashboard for autentication for sql and show the archives for this user?

KoolReport commented on Aug 18, 2021

Here is the documentation of Login and authentication

Andrea Granzotto commented on Aug 18, 2021

Yes, I saw this. But I can't understand how can I access the database? So my problem is related to the access to database. I have to select the user that have certain username in the database and I have to check the password. Can I use the "DataSource" module? and How? or I have to use the "php mysqli"? so creating a connection with the database

KoolReport commented on Aug 18, 2021

In our example you use AutoMaker datasource, so in the authenticate() function you simply do.

->authenticate(function($username,$password) {
    $users = AutoMaker::table("users")
                    ->where("username",$username)
                    ->where("password",md5($password))
                    ->run();
    // The $users is DataStore object which contain list of user, 
    // something like Collection class in Laravel if you know.
    $user = $users->get(0);
    if($user==null) return false;
    return User::create()
                ->id($user["id"])
                ->name($user["name"]);
})

Above code is just an example of how to use DataSource.

Hope that helps.

Javier Gallardo commented on Aug 19, 2021

How I connect the database with App.php??????

KoolReport commented on Aug 19, 2021

Please refer to this answer to know how to create the data connection to your database.

Javier Gallardo commented on Aug 20, 2021

I only capitalized here in my database it is all lowercase

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Dashboard