Thursday, 15 March 2012

iphone - Can always login -


Both a colleague and I have stumbled over the bug in our code, we both have to work on a login page. I am using the Networking Library AFNetworking to connect to an external source, which states that the friend is actually registered or not (but without any external library) (code is for iOS.)

We both are running in the same problem: after making a valid call, everything goes according to expectation, but if we make another call that is invalid (eg, the wrong user name And / or password) I am still able to login.

Why? We are not saving any information

Here are some code:

  BasicAuth * manger = [BasicAuth sharedManager]; Stampede = zero; [[Basic Ath Share Manager] Set You Usman: @ "bad_username" and password: @ "wrong"]; [[Basic Ath Shared Manager] GetPath: @ "/ User / Token" Parameter: Not Success: ^ (FHttpKAEASTE Operation, ID Response Object) {NSLog (@ "Operation =% @", [Reactionary Description]); NSError * Error = Zero; / * * / If (error) {NSLog (@ "error serializing% @", error); }} Failure: ^ (FHTPPRKAVE Operation * Operation, NSERR * Error) {if (operation.response.statusCode == 500) {} else {NSData * jsonData = [operation.responseString dataUsingEncoding: NSUTF8StringEncoding]; // NSString * Error Message = [objectForKey: @ "Error"]; NSLog (@ "We have a problem% @", [error description]); }}]; Yes come back   

If I call this a similar code but call with the correct username / password and then call the above code, I can still log in and The information I get back is the same when I sent "good" request Also, when I try to request a login to use curls from my laptop, I do not go to the same issue, From which I think That is, for some reason, the information being sent is not being updated. But I can not see how or why, again this is whether the third party library is being used or not.

Thoughts, suggestions?

Note: BasicAuth (see above) is the subclass of AFHTTPCLIENT

Your server The cookie is sending and the iOS is storing it. Try to delete cookies before setting new user name and password Here you have a code snippet that deletes all cookies Keep in mind that cookies are private in iOS, so deleting them will not affect other applications.

  NSHTTPCookieStorage * storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; NSArray * Cookies = [Storage cookies]; (NSHTK Cookie * Cookies for cookies) {[Delete cookies: Cookies]; }    

No comments:

Post a Comment