Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
[Solved] How to add an user to the vanilla user table in db using external code?
i have these scenario --
using vanilla v2.0.9
1) I have a site with its own membership system with its own registration and management
2) I have installed vanilla into another database (I can't merge both db into one)
3) I want to be able to add an user to vanilla user table as soon as an user registers to my site
I can add the user info at the vanilla table + add a default role. What i can't do is set password with proper encryption.
Is there any function that can take the password string and return me the proper encrypted password valid for vanilla?
or is there any user manager manager class that can accept parameters like username, email, password, etc. and create the user for me?
Please help!
Thanks,
Anjan
using vanilla v2.0.9
1) I have a site with its own membership system with its own registration and management
2) I have installed vanilla into another database (I can't merge both db into one)
3) I want to be able to add an user to vanilla user table as soon as an user registers to my site
I can add the user info at the vanilla table + add a default role. What i can't do is set password with proper encryption.
Is there any function that can take the password string and return me the proper encrypted password valid for vanilla?
or is there any user manager manager class that can accept parameters like username, email, password, etc. and create the user for me?
Please help!
Thanks,
Anjan
0
Comments
The topic is really hard it seems.
Can anybody please just point me out 2 things?
1) Exactly in which file the password is being encrypted
2) In which file the user cookie is being created
Thats all i need to know to make a patch up bridge between my sites users and vanilla
Thanks again!
To add a user, you can use the V2 framework (fire it up via a remote call and then call its internal classes) or write your own code snippet that inserts a user record. I conjecture the latter would be simpler, but I haven't done it yet myself. Vanilla 2 uses PHPass via /library/core/class.passwordhash.php to encrypt the password. Similarly you can find the cookie "stuff" in library/core/class.cookieidentity.php.
To log in a user, I'd look at the Proxyconnect plugin.
Hopefully that's enough to get you started.
Thanks for the answer
While i checked it seems like vanilla session is stored solely in cookies, 2 cookies it seems "vanilla" and "vanilla-volatile" i think
So, when my users sign in via sites login, i can create those 2 cookies and if they are valid, that should login the users to vanilla without problem, isn't it?
Thanks,
Anjan
Thanks! I finally settled for 2 functions -
1) Gdn_PasswordAuthenticator::Authenticate($email,$password);
2) UserModel::InsertForBasic($user_data);
The first one sets the cookie for me given the email and password is correct
The second one actually accepts values from $_POST, so i mimicked a post using that function and it handled insert for me except password is stored in md5 hash instead of phphash.
I think any one trying to integrate vanilla with existing site, can make use of such methods and i m sure many does so
Thanks for your help! Really appreciate that! Have a nice day
Anjan
I want to do the same thing
I was thinking I could query the Vanilla database and get the right values then just set the cookies.