Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to display the admin dashboard and how to manually change user password #20

Closed
wassimbj opened this issue Nov 10, 2022 · 13 comments

Comments

@wassimbj
Copy link

Hello it's me again 😁!
I ran the docker demo app and it worked perfectly but when I finish the installation steps it doesn't redirect me to the dashboard, it just sticks at the installation steps, over and over again. any idea what causing this issue ? I think its a session issue I tried to logout and log in back and it just stays at the installation page. Even after the logout I actually find the data that I already input so its saved on the database.

@MIGUELez11
Copy link
Member

Hello again ☺, maybe it's an ux problem?

I mean, once you fill in the admins data, you will receive an email at those addresses, the email contains an activation link, in which you will get asked for the admin password, you NEED to log in through those accounts, for now, it's now possible to do anything else with the super admin profile.

PS: is very important not to open the activation link in the same browser you are logged in with another user, that will cause a redirection to the old user again, and the URL won't work. An other option is to log out before opening it.

We are working on this issue.

@wassimbj
Copy link
Author

Thanks for responding 😁
I actually didn't receive any email. is the email sent using the SMTP credentials I put on the setup step ?

@MIGUELez11
Copy link
Member

Yep, they are used.

Which smtp-service are you using? Maybe its being blocked by your email provider, or it's marked as spam.

If it's the one recommended at the docs, and your email server is Gmail its for sure the spam option, you can always see the sended emails through the smtp server dashboard

@wassimbj
Copy link
Author

Hello 😁👋🏼,
sorry for the late reply, I used Cpanel SMTP server and it didn't work found out that the email is rejected, will see what's the reason but if you have an idea please don't hesitate to let me know, I also tried Mailgun SMTP server but looks like it didn't send the email.

I got a question here I really want to just bypass the setup screen for now, what table should I edit to manually confirm the admin email ?

@MIGUELez11
Copy link
Member

I'll try those providers, and check what's the error.

To bypass the confirmation, I think it will be difficult, firstly, you'll need to mark the user as active at plugins_users::users, but also the password needs to be set through the sended email (it's encrypted), I'll also have a look if the activition URL can be composed through database values

@MIGUELez11
Copy link
Member

MIGUELez11 commented Nov 13, 2022

I've been checking the code, and it should be easy to generate the activation mail.

You'll need to generate a jwt to compose the URL, for this, I'll recommend using jwt.io. The private key can be obtained through the table plugins_users::config, in this table, you'll have to search for the key jwt-private-key, save it for later.

The next thing you should do is get your admin user ID through the plugins_users::users table.

Finally, the last database interaction needed is to get the recovery code, this one is saved at plugins_users::user-register-password, the user column its the user ID.

Now you have all the needed data, you just need to generate a jwt with the following object:

{
	"id": USER_ID, 
	"code": RECOVERY_CODE,
	"iat" : UNIX_TIME,
	"exp": UNIX_TIME
} 

As I've said before, jwt.io is a great tool to obtain it, and once copied, you'll have the activation URL, which is:

DOMAIN/users/register-password?token=YOUR_JWT

Replace domain by your domain (probably localhost:8080), and add your jwt, which needs to be uriEncoded, you can check how to do it at MDN.

Just navigate to the URL, and you'll have it.

@wassimbj
Copy link
Author

Thank you so much!! Will do this for now, and will look at the SMTP problem later 👏😁

@wassimbj
Copy link
Author

Hello 😁,I've successfully got the verification url, when i paste it in the browser i get redirected to private/users/select-profile which shows a loading page then it just goes blank I tried to see the console and looks like there is a frontend error that's stopping the page from rendering

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'profiles')
    at eval (index.js:33:213)
    at updateMemo (react-dom.development.js:17246:19)
    at Object.useMemo (react-dom.development.js:17886:16)
    at useMemo (react.development.js:1651:21)
    at SelectProfile (index.js:33:60)
    ....

did the verification went well ? and by the way how do I know that the user got verified ?

@MIGUELez11
Copy link
Member

MIGUELez11 commented Nov 16, 2022

First of all, I recommend you joining Leemons Discord, and have a closer look at your problem, then we left our conclussions here to help other people with the same problems.

Answering your question about this verification, I think the backend shows a log like username connected to the socket, but as I am not sure it shows at this step. What I am sure about, is that a cookie with the name token will get generated, if it's there, it worked.

The problem is that the user you are logging in, has multiple profiles, so if you don't pick one of it, you won't be able to be fully logged in.

@MIGUELez11
Copy link
Member

Hi!

I needed to do this trick to get an email activation url, I post here the sql used, so if needed, is easier and faster to do :D

use `leemons`;
SET @email = "[email protected]";

SELECT value FROM `plugins_users::config` WHERE `key` = "jwt-private-key";

SELECT code, user FROM `plugins_users::user-register-password` WHERE user = (
	SELECT id FROM `plugins_users::users` WHERE email = @email
);

You just enter the desired user email at the top variable, and everything should work.

The value obtained from the config table is the value which needs to be inserted in jwt.io as secret key (usually at the right, the blue text).

The current unix time can be obtained through epoch converter, and the payload should be:

	{
	  "id": "USER",
	  "code": "CODE,
	  "iat": 1668679279,       // From epoch converter
	  "exp": 1669679279        // I've just changed a number and verify the new date is greater enough.
	}

Also, you don't need to uriEncode the token to work, it's handled by the browser :D

@MIGUELez11
Copy link
Member

Hi!! Any updates on this?

I've been working today with demo and docker installations and I was able to use the platform without errors.

@wassimbj
Copy link
Author

wassimbj commented Dec 1, 2022

Oh sorry hhh school stuff, it actually worked fine thank you so much 😁

@MIGUELez11
Copy link
Member

Perfect, thank you 🕺🏻 🚀.

@MIGUELez11 MIGUELez11 changed the title Unable to display the admin dashboard Unable to display the admin dashboard and how to manually change user password Mar 1, 2023
@MIGUELez11 MIGUELez11 pinned this issue May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants