Thank you for your reply, I took the wrong way.
I followed your hints and every thing goes OK.


On Tue, Feb 11, 2014 at 11:33 AM, Nagaev Boris <[email protected]> wrote:

> Hello,
>
> what error message do you get?
>
> 1. You should get Auth::User instance by calling
> Wt::Auth::Dbo::UserDatabase<AuthInfo>.registerNew().
> 2. then user.addIdentity(Wt::Auth::Identity::LoginName, "name");
> 3. Wt::Auth::PasswordService.updatePassword(user, "password")
> 4. get dbo pointer to AuthInfo by calling
> Wt::Auth::Dbo::UserDatabase<AuthInfo>.find(user)
> 5. create User instance (dbo pointer).
> 6. auth_info.modify()->setUser(user)
>
> See
> https://bitbucket.org/starius/thechess/src/6a878608d405596d22c296a56d94d70aa5c1313b/src/Session.cpp?at=default#cl-196
>  and next function. It is corresponding part of thechess code. Replace
> updatePassword with setPassword to set raw hash. Make sure you performed
> all actions listed above.
>
> Regards,
> Boris Nagaev
>
>
> On Tue, Feb 11, 2014 at 11:58 AM, Muhammad Nasser Al-Noimi <
> [email protected]> wrote:
>
>> Hi,
>>
>> I'm trying to insert default user, but I got several errors. Here is my
>> code
>>
>>     // Create default user
>>     User* user = new User();
>>     // Assign user defaults
>>     user->id = UUID::generate();
>>     user->description = "root";
>>     // Add user to DB
>>     Globe::mySession()->add(user);
>>     // Create new AuthInfo
>>      AuthInfo* auth = new AuthInfo();
>>
>> auth->setPassword("$2y$07$Qw22YzLmQCTLZSDmaRfmb.h5tVG7wWaTr43RGd0rWazeCIgTz9vcy",
>>                       "bcrypt",
>>                       "K.8kShHEMmAhq8ht");
>>     // Set the user
>> -> auth->setUser(user);
>>     // add authInfo to DB
>>     Globe::mySession()->add(auth);
>>     Auth::Dbo::AuthIdentity<AuthInfo>* authId = new
>> Auth::Dbo::AuthIdentity<AuthInfo>("loginname", "root");
>>     auth->authIdentities().insert(authId);
>>
>> I tryed to call auth->setUser(user); before add authInfo to DB but it
>> didn't work and after it and it didn't work too. I don't know where is the
>> problem.
>>
>> Thanks a lot,
>> Muhammad Nasser Al-Noimi
>>
>>
>> ------------------------------------------------------------------------------
>> Android apps run on BlackBerry 10
>> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
>> Now with support for Jelly Bean, Bluetooth, Mapview and more.
>> Get your Android app in front of a whole new audience.  Start now.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
>> _______________________________________________
>> witty-interest mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>
>>
>
>
> ------------------------------------------------------------------------------
> Android apps run on BlackBerry 10
> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> Now with support for Jelly Bean, Bluetooth, Mapview and more.
> Get your Android app in front of a whole new audience.  Start now.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to