Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1241] Ti.Cloud.Users.query has changed without warning

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2015-02-03T15:01:26.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsTCSupportTriage
ReporterMitch Starnes
AssigneeShuo Liang
Created2014-11-25T20:55:57.000+0000
Updated2016-03-08T07:37:37.000+0000

Description

On 11/23/2014, query would return success on a user who had not confirmed. On 11/24/2014, the same query would fail. On 11/25/2014, the behavior reverted. What is going on? Could you supply methods to determine the state of a user so that my code can be independent of changes in ACS? States: does not exist, exists but has not confirmed, exists and has confirmed.

Comments

  1. Shuo Liang 2015-01-15

    Hi, You can query a user who had not confirmed. The only difference between confirmed or non confirmed users is: there is one property like "confirmed_at": "2015-01-15T07:59:03+0000" in response of confirm user, but not in non-confirmed user. Hope this will help you. Regards, Shuo
  2. Mitch Starnes 2015-01-15

    Something changed the behavior of how I check to see if a user is confirmed or not. The changes happened in ACS around the 11/24/2014 and 11/25/2014. There were two changes; both changes broke my app. Here is my diff showing the code changes I had to make: if( typeof user.confirmed_at !== "undefined" ) { Ti.API.info("user confirmed at: " + user.confirmed_at); userRegObj.user_status = 1; + } else { // 11/24/14 MAS: RECENT ACS CHANGE BROKE THIS //} else { // Ti.API.info("user is not confirmed"); // userRegObj.user_status = 0; - } + // 11/25/14 now it's back the way it was + Ti.API.info("user is not confirmed"); + userRegObj.user_status = 0; + } Here is what the code looks like now: Cloud.Users.query({ where: { username: username } }, function (e) { Ti.API.info("queryUser e: " + JSON.stringify(e)); var users = e.users; // if( e.success === true && typeof e.users[0] !== "undefined" ) { if( e.success === true && e.users.length === 1 ) { Ti.API.info("Cloud.Users.query success"); var user = e.users[0]; Ti.API.info(JSON.stringify(user)); if( typeof user.confirmed_at !== "undefined" ) { Ti.API.info("user confirmed at: " + user.confirmed_at); userRegObj.user_status = 1; } else { // 11/24/14 MAS: RECENT ACS CHANGE BROKE THIS //} else { // Ti.API.info("user is not confirmed"); // userRegObj.user_status = 0; // 11/25/14 now it's back the way it was Ti.API.info("user is not confirmed"); userRegObj.user_status = 0; } } else if( e.success === false && e.code === 401 ){ // [INFO] : queryUser e: {"success":false,"error":true,"code":401,"message":"You have to confirm your account before continuing."} Ti.API.info("user is not confirmed"); userRegObj.user_status = 0; } if (typeof callback === "function") { Ti.API.info('Calling callback from queryUser'); callback({user_status : userRegObj.user_status}); } });
  3. Shuo Liang 2015-01-16

    Sorry for your convenience, ACS USER Object should be stable as you can query non-confirmed user now. But you should notice that like I had commented on your "resendConfirmation" ticket, You can't do query API when you login a non_confirmed user(like just create a new one). It will give a a "You have to confirm your account before continuing." message.
  4. Mitch Starnes 2015-01-16

    Can you give me the date this was permanently fixed?
  5. Shuo Liang 2015-01-17

    Actually, This behave should be alway like what I mentioned. On 11/24, it could be an accident during a cloud update, that is why the behave revert back to normal on 11/25, so you can use query API safely.
  6. Mauro Parra-Miranda 2015-02-03

    Working as expected now.

JSON Source