Error Types For User Login And Registration?

Is there a way to get information about why a user registration or login failed? Invalid password, that username is already taken, server problem, etc?

Hi,

You should be get a message telling you if the username or email is already taken.

In the case a wrong password/username(email) is used, then you will be notified that either username/password is incorrect.

Thanks

-Mohamed

Forgive me, but I can’t seem to figure this out based on the documentation and code samples I can find (I know you guys are working on that, thank you!)

For example, when trying to register either a new or an existing account, I still get the same event. I assume that like with logging in, there should be a seperate event for registration failure? The documentation only lists “Success” as a return.

local function registrationHandler( event ) print("UserRegistered event called.") end Runtime:addEventListener( "UserRegistered", registrationHandler ) coronaCloud.registerUser( "", "", "testAct001", "testAct001@tester.com", "testAct" )

You need to print out the event table.  Look for the print_r() function in the community code or anyone elses printTable() function.  Your error message is part of that event table.

Hi,

You should be get a message telling you if the username or email is already taken.

In the case a wrong password/username(email) is used, then you will be notified that either username/password is incorrect.

Thanks

-Mohamed

Forgive me, but I can’t seem to figure this out based on the documentation and code samples I can find (I know you guys are working on that, thank you!)

For example, when trying to register either a new or an existing account, I still get the same event. I assume that like with logging in, there should be a seperate event for registration failure? The documentation only lists “Success” as a return.

local function registrationHandler( event ) print("UserRegistered event called.") end Runtime:addEventListener( "UserRegistered", registrationHandler ) coronaCloud.registerUser( "", "", "testAct001", "testAct001@tester.com", "testAct" )

You need to print out the event table.  Look for the print_r() function in the community code or anyone elses printTable() function.  Your error message is part of that event table.

Would be nice to have something like event.response here, instead of looping through items in a table to check the result.

Hi rmbsoft,

The error message is always present in the same subtable, so just look for the table once and the implement it like this:

"The registration gave the following errors: "…event.errorMsgTable

You need to sort out how this table is called because I am not sure

Hope this helps

From my testing there is no error table in the case of username or email already taken.

Here is the result you get:

event.results.username[1] = “has already been taken”

event.results.email[1] = “is already taken”

So the only way to check for error is to use the if statements

if(event.results.username[1] == “has already been taken”)

if(event.results.email[1] == “is already taken”)

Can someone from Corona team confirm this is the only way to check this ?

Here is the code I am using so far:

local function registrationHandler( event )     local err1 = "has already been taken"     local err2 = "is already taken"          if(event.results.username~=nil and event.results.username[1] == err1) then         native.showAlert( ERROR, "Username " .. err1 .. ".", { OK })     elseif(event.results.email~=nil and event.results.email[1] == err2) then         native.showAlert( ERROR, "Email " .. err2 .. ".", { OK })     else         native.showAlert( INFO, "Registration succeded.", { OK })     end end  

Another question, seems the

coronaCloud.loginAPI( username, pwd )  

triggers the

local function loginSuccess( event )     --store the 'authToken' on login success     currentAuthToken = coronaCloud.authToken end  

even if the user didn’t confirm his email.

Corona team, please confirm this.

@ubj3d.android users can login without having to confirm via the sent email.

Would be nice to have something like event.response here, instead of looping through items in a table to check the result.

Hi rmbsoft,

The error message is always present in the same subtable, so just look for the table once and the implement it like this:

"The registration gave the following errors: "…event.errorMsgTable

You need to sort out how this table is called because I am not sure

Hope this helps

From my testing there is no error table in the case of username or email already taken.

Here is the result you get:

event.results.username[1] = “has already been taken”

event.results.email[1] = “is already taken”

So the only way to check for error is to use the if statements

if(event.results.username[1] == “has already been taken”)

if(event.results.email[1] == “is already taken”)

Can someone from Corona team confirm this is the only way to check this ?

Here is the code I am using so far:

local function registrationHandler( event )     local err1 = "has already been taken"     local err2 = "is already taken"          if(event.results.username~=nil and event.results.username[1] == err1) then         native.showAlert( ERROR, "Username " .. err1 .. ".", { OK })     elseif(event.results.email~=nil and event.results.email[1] == err2) then         native.showAlert( ERROR, "Email " .. err2 .. ".", { OK })     else         native.showAlert( INFO, "Registration succeded.", { OK })     end end  

Another question, seems the

coronaCloud.loginAPI( username, pwd )  

triggers the

local function loginSuccess( event )     --store the 'authToken' on login success     currentAuthToken = coronaCloud.authToken end  

even if the user didn’t confirm his email.

Corona team, please confirm this.

@ubj3d.android users can login without having to confirm via the sent email.