@pyc4 said:
I was thinking it is possible to generate hash from given password that is exactly the same as the hash written to database.
Only if you use the same salt, but you don't have the salt, so therein lies the problem 😄
Hi everyone, thanks for any input on this.
Is there a way to detect if a user is logged in to NodeBB and have them redirected depending on that status?
Specifically,
User visits www.example.com, a basic html home page.
I would appreciate any guidance on this,
Thanks for your time.
You can get loggedIn status from
https://www.example.com/forum/api/user/${username}
It returns a json object with a loggedIn
boolean.
Example (using jquery to fetch)
$.getJSON('https://community.nodebb.org/api/user/yariplus', (data) => {
if (data.loggedIn) window.location.href = 'https://www.example.com/forum/'
})
Thank you for your quick reply.
Is there a way to check logged-in status without specifying a user?
All I want to be able to do is to have a custom homepage for my NodeBB website that only displays to guests.
If one of my registered (& logged in) users visits, have it send them to the forum rather than to the custom homepage.
Thanks again for your help, appreciated.
Yup, you can fetch https://www.example.com/forum/api/me
, it will return an error if not logged in, and an object if you are.