3meters / proxibase

Patchr web service
1 stars 0 forks source link

Email not captured for new passwordless user #421

Closed Jaymassena closed 8 years ago

Jaymassena commented 8 years ago

Created a new password-less user using email and convert from provisional. Service record does not include the email which I would expect to be captured after successfully authorizing with facebook. We should also capture phone number installs too if we aren't already.

{ 
    "_id" : "us.160610.56712.889.908961", 
    "name" : "Superbad", 
    "namelc" : "superbad", 
    "schema" : "user", 
    "_owner" : "us.160610.56712.889.908961", 
    "_creator" : "us.160610.56712.889.908961", 
    "_modifier" : "us.160610.56712.889.908961", 
    "createdDate" : 1.465573512889E12, 
    "modifiedDate" : 1.465574255731E12, 
    "modifiedIp" : "::ffff:174.21.59.25", 
    "photo" : {
        "width" : 1280, 
        "height" : 960, 
        "prefix" : "us.160610.56712.889.908961_20160610_085733.jpg", 
        "source" : "aircandi.images"
    }, 
    "activityDate" : 1.465574255731E12, 
    "role" : "user", 
    "authSource" : "ak", 
    "lastSignedInDate" : 1.465574205041E12, 
    "akid" : "922791121199389"
}
georgesnelling commented 8 years ago

hmmm, thought i had a test for that. I'll take a look.

Jaymassena commented 8 years ago

Might be on my side. Doing more testing

On Jun 10, 2016 9:20 AM, George Snelling notifications@github.com wrote:

hmmm, thought i had a test for that. I'll take a look.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/3meters/proxibase/issues/421#issuecomment-225228429, or mute the threadhttps://github.com/notifications/unsubscribe/AAbzG6q0A--3HuDymksKBGHk8tjWjm4Bks5qKY61gaJpZM4IzG0s.

georgesnelling commented 8 years ago

I have a test for checking the email from a user who transitioned from password to email password, but I don't have one for the new email case. quite possibly mine. It will take me a bit to figure it out, because I need to create a new durable test user in 3meters and do that whole dance, but we need to cover that case.

georgesnelling commented 8 years ago

Although we don't have a test for it it appears the new user case is working properly for passwordless email, and setting and returning the users email address. In this case it appears that you set the email address to null in an update. I have code on a new dev build that will prevent the user from changing an email that was validated by account kit, but it is not tested yet. I think you might be able to fix this problem on your side.

==== Req: 22963370, from: ::ffff:174.21.59.25, worker: 1, on: Fri, 10 Jun 2016 15:56:44 GMT post /v1/auth/ak { getEntities: true, links: { shortcuts: true, active: [ { links: true, count: true, schema: 'patch', type: 'like', limit: 0, direction: 'out' }, { links: true, count: true, schema: 'patch', type: 'create', limit: 0, direction: 'out' }, { links: true, count: true, schema: 'patch', type: 'watch', limit: 0, direction: 'out' }, { links: true, count: true, schema: 'message', type: 'create', limit: 0, direction: 'out' } ] }, authorization_code: 'AQCL0Jr96ARIN-dNX-AECogAP5ncIIlofEfz_Q5aGVWEKzSQc8NizMTxzMYqasWtgQpGHkh_jyvO-wgCJsgRW2nh7AeVsYRx_pO4KqdtOmFmh91Qijx9RqNmb1qAy_qAcl9_5TCtbE_cXd7sM7e0WhvXB0UvHhvoYRMMMT4Qfxt9oVm4Fje0tbKCSMpskq0BLSinA3PaeXAcQtOiIPrp90BTS5lYyRdAHj5MlXe5EcXySqqfuoZrzjH5Qr2WXOSoCnOyfEfUVZx46Fddj8Gt9Qrg', install: '22f382a81ae67917' } accountKit return payload { email: { address: 'jay@patchr.com' }, id: '922791121199389' } accountKit payload after scrubbing { email: 'jay@patchr.com', id: '922791121199389' } debug accountKit user query { '$or': [ { akid: '922791121199389' }, { email: 'jay@patchr.com' } ] } debug accountKit user query results [ { _id: 'us.160610.56712.889.908961', schema: 'user', _owner: 'us.160610.56712.889.908961', _creator: 'us.160610.56712.889.908961', _modifier: 'us.160610.56712.889.908961', createdDate: 1465573512889, modifiedDate: 1465573512889, activityDate: 1465573512889, email: 'jay@patchr.com', role: 'provisional', authSource: 'ak', lastSignedInDate: 1465573512892, akid: '922791121199389' } ] debug accountKit updating existing user { _id: 'us.160610.56712.889.908961', schema: 'user', _owner: 'us.160610.56712.889.908961', _creator: 'us.160610.56712.889.908961', _modifier: 'us.160610.56712.889.908961', createdDate: 1465573512889, modifiedDate: 1465573512889, activityDate: 1465573512889, email: 'jay@patchr.com', role: 'provisional', authSource: 'ak', lastSignedInDate: 1465573512892, akid: '922791121199389' } ==== Res: 22963370, time: 576, statusCode: 200

==== Req: 40946688, from: ::ffff:174.21.59.25, worker: 1, on: Fri, 10 Jun 2016 15:57:35 GMT post /v1/do/updateEntity { entity: { password: '**', developer: null, data: null, phone: null, email: null, subtitle: null, schema: 'user', position: null, photo: { width: 1280, height: 960, prefix: 'us.160610.56712.889.908961_20160610_085733.jpg', source: 'aircandi.images' }, _acl: null, description: null, location: null, area: null, role: 'user', name: 'Superbad', _id: 'us.160610.56712.889.908961', type: null }, user: 'us.160610.56712.889.908961', returnEntity: false, session: 'abd7a0eb673e14962bead5ea821254619c66e988' } ==== Res: 40946688, time: 31, statusCode: 200

georgesnelling commented 8 years ago

Remember in the server rest API setting a field to NULL deletes the field from the document. Not setting it at all leaves it unmodified, So to upgrade it from provisional just send

post /v1/do/updateEntity { entity: { schema: 'user', role: 'user', name: 'Superbad', _id: 'us.160610.56712.889.908961', }, user: 'us.160610.56712.889.908961', returnEntity: false, session: 'abd7a0eb673e14962bead5ea821254619c66e988' }

Jaymassena commented 8 years ago

Yeah, the android code serialization code works with whole entities at a time so we always send nulls for empty fields since the code can’t tell that a specific field is dirty. I could write code targeting just this case but that doesn’t make much sense since it won’t be too long before I tear up the data/network layer to make the same rest calls as the iOS client and also support a persistent cache.

-J-

In the code below, do I even need to send schema since it doesn’t need to change?

From: George Snelling Reply-To: 3meters/proxibase Date: Friday, June 10, 2016 at 9:41 AM To: 3meters/proxibase Cc: "jay@3meters.commailto:jay@3meters.com", Author Subject: Re: [3meters/proxibase] Email not captured for new passwordless user (#421)

Remember in the server rest API setting a field to NULL deletes the field from the document. Not setting it at all leaves it unmodified, So to upgrade it from provisional just send

post /v1/do/updateEntity { entity: { schema: 'user', role: 'user', name: 'Superbad', _id: 'us.160610.56712.889.908961', }, user: 'us.160610.56712.889.908961', returnEntity: false, session: 'abd7a0eb673e14962bead5ea821254619c66e988' }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/3meters/proxibase/issues/421#issuecomment-225233673, or mute the threadhttps://github.com/notifications/unsubscribe/AAbzGz5HVwYYBpm0uTClDitMW33Lcardks5qKZPSgaJpZM4IzG0s.

georgesnelling commented 8 years ago

Closing...