KoolReport's Forum

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

Dashboard Login rightImageUrl not showing #2432

Closed Mathieu Viennet opened this topic on on Nov 14, 2021 - 4 comments

Mathieu Viennet commented on Nov 14, 2021

Hi,

I use your code example :

protected function login()
    {
        return Login::create()
            ->headerText("Login")
            ->descriptionText("Sign in to your account")
            ->buttonText("Login")
            ->failedText("Wrong username or password")
            ->rightImageUrl("/assets/img/user-icon.png")
            ->authenticate(function($username,$password){
                
                //You can make database connection in here to authenticate $username or password
                //Return User class when it is authenticated

But, the image icon setting seems not to work...in Chrome i get : src(unknown)

Thanks for helping

Mathieu Viennet commented on Nov 14, 2021

I basically hardcoded the image link in the theme file...but i would like to know why your setting is not working...

koolreport/dashboard/amazing/Main.header.view.php line 42

<img alt="<?php echo $user->name(); ?>" src="<?php echo $user->avatar(); ?>" class="img-avatar">
Mathieu Viennet commented on Nov 14, 2021

OK...i messed around and figured it...you need to update your documentation (unless rightImageUrl is supposed to be a placeholder if there's no Avatar specified....) :

Avatar needs to be set when you define a user :

if($username==="your_username" && $password==="your_password") {
                    return User::create()
                        ->name("Username")
                        ->id(1)
                        ->roles(["guest"])
                        ->avatar("/assets/img/user-icon.png");
                }
KoolReport commented on Nov 15, 2021

The rightImageUrl is not for user. It is the url of image in login screen. When you to to Login screen, you see the bluesky image on the right. You can set the image to another, that's all. You are right that the user avatar is set to User object.

Mathieu Viennet commented on Nov 15, 2021

Oh! OK thanks for clarifying :)

Would still be good to add the Avatar to the User object example :)

Have a good day

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
solved

None