mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-16 02:20:07 +00:00
Fix broken auth
The commit 1678d7550a0cc667b14e1efa5608ce3d271bfa42 did break BITAuthenticator
This commit is contained in:
parent
c8a3830ce3
commit
a441811a42
@ -440,16 +440,20 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
|
|||||||
|
|
||||||
- (NSURLRequest *) requestForAuthenticationEmail:(NSString*) email password:(NSString*) password {
|
- (NSURLRequest *) requestForAuthenticationEmail:(NSString*) email password:(NSString*) password {
|
||||||
NSString *authenticationPath = [self authenticationPath];
|
NSString *authenticationPath = [self authenticationPath];
|
||||||
NSDictionary *params = nil;
|
NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
||||||
|
|
||||||
|
NSString *installString = bit_appAnonID();
|
||||||
|
if (installString) {
|
||||||
|
params[@"install_string"] = installString;
|
||||||
|
}
|
||||||
|
|
||||||
if(BITAuthenticatorIdentificationTypeHockeyAppEmail == self.identificationType) {
|
if(BITAuthenticatorIdentificationTypeHockeyAppEmail == self.identificationType) {
|
||||||
NSString *authCode = BITHockeyMD5([NSString stringWithFormat:@"%@%@",
|
NSString *authCode = BITHockeyMD5([NSString stringWithFormat:@"%@%@",
|
||||||
self.authenticationSecret ? : @"",
|
self.authenticationSecret ? : @"",
|
||||||
email ? : @""]);
|
email ? : @""]);
|
||||||
params = @{
|
|
||||||
@"email" : email ? : @"",
|
params[@"email"] = email ? : @"";
|
||||||
@"authcode" : authCode.lowercaseString,
|
params[@"authcode"] = authCode.lowercaseString;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableURLRequest *request = [self.hockeyAppClient requestWithMethod:@"POST"
|
NSMutableURLRequest *request = [self.hockeyAppClient requestWithMethod:@"POST"
|
||||||
@ -462,18 +466,6 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
|
|||||||
[request setValue:authValue forHTTPHeaderField:@"Authorization"];
|
[request setValue:authValue forHTTPHeaderField:@"Authorization"];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableData *postBody = [NSMutableData data];
|
|
||||||
NSString *boundary = @"----FOO";
|
|
||||||
|
|
||||||
NSString *installString = bit_appAnonID();
|
|
||||||
if (installString) {
|
|
||||||
[postBody appendData:[BITHockeyAppClient dataWithPostValue:installString forKey:@"install_string" boundary:boundary]];
|
|
||||||
}
|
|
||||||
[postBody appendData:[[NSString stringWithFormat:@"--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
||||||
|
|
||||||
|
|
||||||
[request setHTTPBody:postBody];
|
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user