Ticket #583 (closed Bug report: fixed)

Opened 10 years ago

Last modified 10 years ago

Can't Create User

Reported by: dinesh_nadeera@… Owned by:
Priority: high Milestone: Not yet assigned to a Milestone
Component: Auth server, Authentication, permissions and access control Version:
Keywords: Cc:

Description

execSqlUpdate() : An error occured while executing the following SQL query :

INSERT INTO users 
(user_id,username, account_origin,email,pass,account_status,validation_token,reg_date) VALUES 
('8085462439ce9b445ca5efa7640af497','dinesh','','dinesh_aaaa@
yahoo.com','4QrcOUm6Wau+VuBX8g+IPg==','5','e375c0ed94d3a44093119aefaef3d9d5',CURRENT_TIMESTAMP)

Error message :

ERROR: insert or update on table "users" violates foreign key constraint "account_origin_fkey" DETAIL: Key (account_origin)=() is not present in table "networks".

Backtrace: #0 /var/www/wifidog-auth/wifidog/classes/User.php(237): AbstractDb?->execSqlUpdate() #1 /var/www/wifidog-auth/wifidog/signup.php(219): User::createUser()

Both installed in two different machines. The server and the gateway work fine but after going create new user above error happen

I used Ubuntu 9.04 with updated software,

Change History

  Changed 10 years ago by dinesh_nadeera@…

I think i found the bug it is in "signup.php" page below code(last part of page). I have no idea why it not working.

if (Server::getServer()->getUseGlobalUserAccounts())

$smarty->assign('SelectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='$default_network_param' />");

else

$smarty->assign('SelectNetworkUI', Network::getSelectUI('network_id', array('preSelectedObject' => $network)) );

My solution is instead of using above code i used below code it work, but i don't know using this code affect other code or not please give your comment.

solution:- $smarty->assign('SelectNetworkUI', Network::getSelectUI('auth_source'));

  Changed 10 years ago by jones.tech.consulting@…

I'm also having this problem on a Debian Lenny install. Can someone confirm if this is a bug or a config problem?

  Changed 10 years ago by benoitg

  • status changed from new to closed
  • resolution set to fixed

Fixed in [1395]

  Changed 10 years ago by jones.tech.consulting@…

  • status changed from closed to reopened
  • resolution fixed deleted

I just did an svn checkout, and it said my new version is 1398, but I'm still having what appears to be the same issue. Here's the output:

Notice: Undefined index: auth_source in /var/www/wifidog-auth/wifidog/signup.php on line 172 execSqlUpdate() : An error occured while executing the following SQL query : INSERT INTO users (user_id,username, account_origin,email,pass,account_status,validation_token,reg_date) VALUES ('74fe7c556ad79d1345fd74810f6fc569','testuser',,'jones.tech.consulting@…','zSEQ/dzkQdh+IjckiTVnpg==','5','3367867dfaa80d426ce89e0ebe65fa44',CURRENT_TIMESTAMP)

Error message : ERROR: insert or update on table "users" violates foreign key constraint "account_origin_fkey" DETAIL: Key (account_origin)=() is not present in table "networks".

Backtrace:

#0 /var/www/wifidog-auth/wifidog/classes/User.php(237): AbstractDb?->execSqlUpdate() #1 /var/www/wifidog-auth/wifidog/signup.php(219): User::createUser()

  Changed 10 years ago by benoitg

  • status changed from reopened to closed
  • resolution set to fixed

I can't reproduce, but I think I found the cause. Try with [1399] and report back please.

  Changed 10 years ago by jones.tech.consulting@…

After updating to build 1399, the same error is still occurring.

  Changed 10 years ago by benoitg

Ok, a few questions, in order:

  • What's the id of you default network?
  • On the signup.php page (before submitting), open the pages source, and serach for the string "auth_source", it should be a hidden form parameter. It it there, and what's the value?
  • In Server administration => Server configuration, do you have "Use the users of default Virtual Host's network across all networks on the server." checked or unchecked (there is nothing wrong with either, but it tells me which code path to review).

follow-up: ↓ 1   Changed 10 years ago by dinesh_nadeera@…

  • status changed from closed to reopened
  • resolution fixed deleted

You again fix signup.php wrongly, look at your line 342

$smarty->assign('SelectNetworkUI', Network::getSelectUI('auth_source', array('preSelectedObject' => $network)) );

in here $network must be "$networkObject"

correct code is --

$smarty->assign('SelectNetworkUI', Network::getSelectUI('auth_source', array('preSelectedObject' => $networkObject)) );

Please confirm this is write or wrong?

  Changed 10 years ago by dinesh_nadeera@…

Related to above my reply

Using your solution this error happen in signup.php(try to create new user )

Notice: Undefined variable: network in /var/www/wifidog-auth/wifidog/signup.php on line 342.

After adding above my solution it works,

New problem is -- I created new network then I tried to add new user for new network then below error happen

Fatal error: Call to a member function getId() on a non-object in /var/www/wifidog-auth/wifidog/signup.php on line 241

But data go to database and validation email not send to the user.

please help.

in reply to: ↑ 8   Changed 10 years ago by benoitg

Please confirm this is write or wrong?

That would have been incorrect (the last nework in the list would always have been seleceted).

  Changed 10 years ago by benoitg

Try with [1401]:

  • Refactor signup.php. The code flow is still annoyingly unclear complex, but the file is shorter and hopefully easier to debug (and hopefully fixes #593)

follow-up: ↓ 13   Changed 10 years ago by dinesh_nadeera@…

I created Network using below parameters

Network

Network id    - 203
Network name  - Comman network
Network creation date - 2009-07-08
Network authenticator class - AuthenticatorLocalUser
Original URL redirection  - yes
Validation grace period - 1200
validation email - validation@wifidognetwork

Node create like this

Node

gateway ID -  303
in Network -  Comman network
Gateway ID - 303
Name - Comman node
Original URL redirection -yes

Then I try to create user using this network but same error happen

Fatal error: Call to a member function getId() on a non-object in /var/www/wifidog-auth/wifidog/signup.php on line 230

But data go to database, I kept that window more than 5min then it automatically redirect to correct page(You have 20min to validate your email)

I try to find error but still i don't know reason for that.

My process(Create network,node) write or not ?


Next I tried to logging system, using above created username and password but I could not log into system. I found this error -- AuthenticatorLocalUser?.php line 124

$this->getNetwork()->getId()

always set same network name in my situation it always set to 'default-network' if I set it 203 then above created user can logging to system.

waiting for your reply

in reply to: ↑ 12   Changed 10 years ago by benoitg

Replying to dinesh_nadeera@yahoo.com:

Ok, we are narrowing it down.

I added error messages to svn this morning in the code path you are hitting.

What do you have in the authenticator constructor parameters?

  Changed 10 years ago by dinesh_nadeera@…

Network
Authenticator parameters = null(blank)

if i put value in above field like 'test' below exception throw

Detailed error was: Uncaught Exception The network with id test could not be found in the database (0) thrown in file /var/www/wifidog-auth/wifidog/classes/Network.php, line 384

#0 /var/www/wifidog-auth/wifidog/classes/Network.php(90): Network->__construct('test')
#1 /var/www/wifidog-auth/wifidog/classes/Authenticator.php(81): Network::getObject('test')
#2 /var/www/wifidog-auth/wifidog/classes/Authenticators/AuthenticatorLocalUser.php(77): Authenticator->__construct('test')
#3 [internal function]: AuthenticatorLocalUser->__construct('test')
#4 [internal function]: ReflectionClass->newInstance('test')
#5 /var/www/wifidog-auth/wifidog/classes/Network.php(688): call_user_func_array(Array, Array)
#6 /var/www/wifidog-auth/wifidog/classes/Authenticator.php(169): Network->getAuthenticator()
#7 /var/www/wifidog-auth/wifidog/login/index.php(258): Authenticator::getLoginUI()
#8 {main}

Until i remove that value in database I can't go any page same error happen.

If i put 'default-network' and save Dinesh network work find but problem is next i go to login screen and try to login as admin. Correct proceeder is i should select Admin network but here if I select Dinesh network I can log into system. That should not happen is it write?

what kind of value should i put here.

  Changed 10 years ago by dinesh_nadeera@…

I downloaded latest version(Checked out revision 1407) of auth server using

svn checkout https://dev.wifidog.org/svn/trunk/wifidog-auth

After try to create new user it issue below error massage(signup.php), but all data go to database(create user, validation email go to user email, using that account also can logging into system)

Unable to authenticate newly created user. Please report this bug. Error was: Login successfull 

please help.

follow-up: ↓ 17   Changed 10 years ago by delphi9_1971@…

I too am having this "Unable to authenticate newly created user. Please report this bug. Error was: Login successfull" I'm running the Auth Server on Ubuntu 9.04 Server, I see other errors above are also related to Ubuntu flavors. I'm not a programmer (Just a lowly sys admin :-) ) so I'm not sure how to test for some of the above items. But let me know if there is anything I can check for to help.

in reply to: ↑ 16 ; follow-up: ↓ 18   Changed 10 years ago by benoitg

Replying to delphi9_1971@yahoo.com:

You just gave us exactly the information we needed. Latest problem fixed in [1408]

in reply to: ↑ 17   Changed 10 years ago by anonymous

Replying to benoitg:

Replying to delphi9_1971@yahoo.com: You just gave us exactly the information we needed. Latest problem fixed in [1408]

SWEET!!! That fixed it!!! THANK YOU!

  Changed 10 years ago by networkfusion

  • status changed from reopened to closed
  • resolution set to fixed

  Changed 10 years ago by daria

yk6obW Gra7noI59Unral92Bb7wf

Note: See TracTickets for help on using tickets.