ajones05 / seearound.me-ionic

0 stars 0 forks source link

GO: email signup issues #82

Closed ajones05 closed 8 years ago

ajones05 commented 8 years ago

email signup isn't working for me img_3655

img_3656

abdulhafeez commented 8 years ago

It seems something changed when things moved to new server. The image file is transferred but in the end, the server does not respond properly. @yuriyua has to come to help here.

This is the response I am getting: 2016-07-30 05:56:06.035 SeeAroundGo[414:133314] Uploaded 24010 of 24010 2016-07-30 05:56:07.933 SeeAroundGo[414:133772] FileTransferError { body = ""; code = 3; "http_status" = 0; source = "file:///var/mobile/Containers/Data/Application/90CCD37C-8FB2-4485-8638-45BA47B0F7E3/tmp/cdv_photo_002.jpg"; target = "http://www.seearoundgo.com/mobile/registration"; } 2016-07-30 05:56:07.933 SeeAroundGo[414:133772] File Transfer Error: The network connection was lost. 2016-07-30 05:56:07.971 SeeAroundGo[414:133314] WARN: {"code":3,"source":"file:///var/mobile/Containers/Data/Application/90CCD37C-8FB2-4485-8638-45BA47B0F7E3/tmp/cdv_photo_002.jpg","target":"http://www.seearoundgo.com/mobile/registration","http_status":null,"body":null,"exception":null}

abdulhafeez commented 8 years ago

I tried to register without an image and got this failure response:

{"data":{"status":"FAILED","message":"Internal Server Error"},"status":200,"config":{"method":"POST","transformRequest":[null,null],"transformResponse":[null],"url":"http://www.seearoundgo.com/mobile/registration","data":{"name":"Test101","email":"test101@test.com","password":"test101","street_number":"Abu Hurera Street#19, Chaman Park Fatehgarh","streetname":"Abu Hurera Street#19","city":"Lahore","state":"Punjab","country":"PK","zip":"54840","latitude":31.56772643049134,"longitude":74.40354256927414},"headers":{"Content-Type":"application/x-www-form-urlencoded","Accept":"application/json, text/plain, /_"}},"statusText":"OK"}

yuriyua commented 8 years ago

fixed issue was in the server email settings, I disabled it for now and Ill fix it tomorrow

ajones05 commented 8 years ago

Hi @abdulhafeez @yuriyua is this done? I was hoping it would be faster to submit this app to the app stores... is there anything else that needs to be addressed before we can finalize this GO version and submit? Thanks

abdulhafeez commented 8 years ago

I have tested it and it is still not working. Same error. Once this issue goes, we need to test all other functions before releasing.

ajones05 commented 8 years ago

@yuriyua I'm still getting the same error, too.

yuriyua commented 8 years ago

start debug errors (sorry for long response)

abdulhafeez commented 8 years ago

OK, I am going to try to register now.

yuriyua commented 8 years ago

thanks, how much time you will still online?

abdulhafeez commented 8 years ago

I will be online for long time ... 3, 4 hours or more

abdulhafeez commented 8 years ago

This time, I got success response on registration but json params are different. The "response" has changed to "data". Let me make the change and try again.

abdulhafeez commented 8 years ago

With some adjustments, registration without image is now working:

{"status":"SUCCESS","token":"K74NL56M1M3RFF6X78EXZD3YMSF5YD6HKA88EEVF3Y8IEEFMMXIMALKZF34DFAY3"} 2016-08-02 02:42:15.012 SeeAroundGo[356:93588] Going to login ... 2016-08-02 02:42:15.647 SeeAroundGo[356:93588] Login success ... 2016-08-02 02:42:15.647 SeeAroundGo[356:93588] {"status":"SUCCESS","message":"AUTHENTICATED","result":{"id":"406","karma":0,"Name":"Test 114","Email_id":"test114@test.com","Birth_date":null,"Profile_image":"http://www.seearoundgo.com/uploads/default.jpg","address":"Canal Bank Road, Lahore, Punjab, PK","latitude":"31.56705953447116","longitude":"74.40357764665697","Activities":null,"Gender":null,"token":"K6B2L7HN6Q8L7P9TLSHXF5XX71BNBAQYF313AHRGA24GQCCD7VBN18K89YXK8NIP"}}

yuriyua commented 8 years ago

ok, I work on image issue I'll let you know where you can test it, Thanks

yuriyua commented 8 years ago

Fixed. Could you test it now, please?

abdulhafeez commented 8 years ago

It is a success but can you please change "response" to "data" in this case too?

{"responseCode":200,"response":"{\"status\":\"SUCCESS\",\"thumb\":\"http:\/\/www.seearoundgo.com\/uploads\/t6b6hdritm.jpg\",\"token\":\"8K528AHQTTPSTPB9K4A916FCBZQ5HLSR8ZSG9C847YY2NAAADLKDS2Q62HBK65CD\"}","bytesSent":41928,"headers":{"Access-Control-Allow-Origin":"*","Keep-Alive":"timeout=5, max=100","Expires":"Thu, 19 Nov 1981 08:52:00 GMT","Server":"Apache/2.4.7 (Ubuntu)","Content-Type":"application/json","X-Powered-By":"PHP/5.5.9-1ubuntu4.17","Content-Length":"159","Pragma":"no-cache","Cache-Control":"no-store, no-cache, must-revalidate, post-check=0, pre-check=0","Date":"Mon, 01 Aug 2016 22:54:36 GMT","Connection":"Keep-Alive"}}

yuriyua commented 8 years ago

done

"{\"status\":\"SUCCESS\",\"thumb\":\"http:\/\/www.seearoundgo.com\/uploads\/t6b6hdritm.jpg\",\"token\":\"8K528AHQTTPSTPB9K4A916FCBZQ5HLSR8ZSG9C847YY2NAAADLKDS2Q62HBK65CD\"}"

=>

"{\"status\":\"SUCCESS\",\"data\":{\"thumb\":\"http:\/\/www.seearoundgo.com\/uploads\/t6b6hdritm.jpg\",\"token\":\"8K528AHQTTPSTPB9K4A916FCBZQ5HLSR8ZSG9C847YY2NAAADLKDS2Q62HBK65CD\"}}"
abdulhafeez commented 8 years ago

Sorry, but you did it at the wrong place. Problem is, I have one function handling both registration scenarios: with and without an image. So, the response should be same for both. It was same for both before. I want it like this:

{"data":{"status":"SUCCESS","data":{"token":"VILHITDBB5VDD8R5N5M2L4NCGTS2DIVA4GTMC81NDV3S4TYSZLVLPI18ESASC64G"}},"status":200,"config":{"method":"POST","transformRequest":[null,null],"transformResponse":[null],"url":"http://www.seearoundgo.com/mobile/registration","data":{"name":"Test 119","email":"test119@test.com","password":"test119","street_number":"C/2","streetname":"Nabi Pura Road","city":"Lahore","state":"Punjab","country":"PK","zip":"54000","latitude":31.56876708548274,"longitude":74.40135313661476},"headers":{"Content-Type":"application/x-www-form-urlencoded","Accept":"application/json, text/plain, /_"}},"statusText":"OK"}

abdulhafeez commented 8 years ago

In fact, it was to be done on two places. Please also change the 'response' at the very start :

{"responseCode":200,"response":"{\"status\":\"SUCCESS\",\"data\" ...

abdulhafeez commented 8 years ago

It should be : {"responseCode":200,"data":"{\"status\":\"SUCCESS\",\"data\" ...

yuriyua commented 8 years ago

I'm not sure if it is right to change response header name response => data (this name is from server side, not from code) Can we make it in other way?

abdulhafeez commented 8 years ago

Ok, then change both to response as it was before

abdulhafeez commented 8 years ago

But please, in both cases, with or without image, response should be same.

yuriyua commented 8 years ago

Can you show me in which gateways I need to change it?

But please, in both cases, with or without image, response should be same.

return field thumb for both cases in response (/mobile/registration)?

abdulhafeez commented 8 years ago

Gateway is only one: mobile/registration but I am getting different response if I include image. When there is no image, I get this: {"responseCode":200,"data":"{\"status\":\"SUCCESS\",\"data\" ...

When there is image upload, I get this: {"responseCode":200,"response":"{\"status\":\"SUCCESS\",\"data\" ...

abdulhafeez commented 8 years ago

One gateway should always return one type of json response.

yuriyua commented 8 years ago

is there the same issue in the seearound.me/mobile/registration ?

abdulhafeez commented 8 years ago

No, in seearound.me/mobile/registration, I get this:

{"responseCode":200,"response":"{\"status\":\"SUCCESS\",\"data\" ...

in both cases

abdulhafeez commented 8 years ago

It was working like that very fine in SeeAroundMe

abdulhafeez commented 8 years ago

Just copy from SeeAroundMe

yuriyua commented 8 years ago

it's from the server side configuration. let me think how to fix it Can we leave it for tomorrow?

abdulhafeez commented 8 years ago

I can make arrangement on my side for now. I can change the code to handle both type of responses but it is not good. Anyway, I am going to change on my side.

yuriyua commented 8 years ago

ok, Thanks

abdulhafeez commented 8 years ago

OK, I have got it working now.

yuriyua commented 8 years ago

@abdulhafeez can you show me full api query?

I cannot find this difference in the raw response data https://en.wikipedia.org/wiki/HTTP_message_body

http://www.seearound.me/mobile/registration

$ curl -i -X POST --form "image=@1hrzkyghsq.jpg" --form email=test3331@test.com --form name=test --form password=test12345678 --form latitude=1 --form longitude=1 http://www.seearound.me/mobile/registration
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1041k  100   165  100 1041k     16   104k  0:00:10  0:00:10 --:--:--  103kHTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Tue, 02 Aug 2016 14:38:18 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) PHP/5.6.12
X-Powered-By: PHP/5.6.12
Set-Cookie: user_session=ujefk7habpn6vtlh06d0cle1m7; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Access-Control-Allow-Origin: *
Content-Length: 165
Content-Type: application/json

{"status":"SUCCESS","data":{"thumb":"http:\/\/www.seearound.me\/uploads\/58bscfz1fx.jpg","token":"I9FKIGINA1ZHN5KT6N51MA814LF4MX276GRPZCEACES2IEXQ52QRC1RFL9KA6LHC"}}

http://www.seearoundgo.com/mobile/registration

$ curl -i -X POST --form "image=@1hrzkyghsq.jpg" --form email=test3331@test.com --form name=test --form password=test12345678 --form latitude=1 --form longitude=1 http://www.seearoundgo.com/mobile/registration
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1041k  100   168  100 1041k     17   105k  0:00:09  0:00:09 --:--:-- 91610HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Tue, 02 Aug 2016 14:40:47 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.17
Set-Cookie: PHPSESSID=fl4svbsoajrnhdn8cuaio9dnq5; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Access-Control-Allow-Origin: *
Content-Length: 168
Content-Type: application/json

{"status":"SUCCESS","data":{"thumb":"http:\/\/www.seearoundgo.com\/uploads\/yz8axq2dk3.jpg","token":"MK8C69VBMYMVN14XAQBF7AEFLB7NPRQDCZQI9MXXLISAIX7VNIBVVQBG4I6SCX8Q"}}
abdulhafeez commented 8 years ago

That is right but difference is out side of it: {"responseCode":200,"response":"{"status":"SUCCESS" ... and {"responseCode":200,"data":"{"status":"SUCCESS" ...

abdulhafeez commented 8 years ago

I am not sure why it is so but I have handled it anyway.

yuriyua commented 8 years ago

It's very interested for me too. Can you check app request client documentation? Because from server side it returns headers and message body without fields: responseCode, response/data...

abdulhafeez commented 8 years ago

My code is same for SeeAroundMe and SeeAroundGo:

     signUp: function (data) {
            var url = API_URL + '/registration';
            //console.log($rootScope.imgUri);
            if($rootScope.imgUri){
                //console.log('Signup with image ...');
                var options = {
                    fileKey: "image",
                    fileName: new Date().getTime() + ".jpg",
                    httpMethod: 'POST',
                    chunkedMode: false,
                    mimeType: "image/jpg",
                    params: data
                };

                return $cordovaFileTransfer.upload(url, $rootScope.imgUri, options, true);
            }
            else{
                //console.log('Signup without image ...');
                return $http({
                    method: 'POST',
                    url: url,
                    data: data,
                    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
                });
            }
     }
ajones05 commented 8 years ago

Was this resolved?

abdulhafeez commented 8 years ago

This has been resolved with a work around on client side. So, nothing needs to be done. It can be closed.