Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make SCAuth login correctly with an email address

  • Loading branch information...
commit 531a8e0df212dfaa26486c8ac6f9342c2920894e 1 parent 98aac6c
Ben Langfeld authored
31 Client/Frameworks/SCAuth/LoginProviders/SCEmailLoginDialogController.j
View
@@ -40,4 +40,35 @@ var DefaultLoginDialogController = nil;
DefaultLoginDialogController = [self newLoginDialogController];
return DefaultLoginDialogController;
}
+
+/* @ignore */
+- (void)_loginUser:(CPString)username password:(CPString)password
+{
+ var shouldRemember = ([_rememberMeButton state] === CPOnState);
+ var loginObject = {'user' : {'email' : username, 'password' : password, 'remember' : shouldRemember}};
+ var request = [CPURLRequest requestWithURL:[[CPBundle mainBundle] objectForInfoDictionaryKey:@"SCAuthLoginURL"] || @"/session/"];
+
+ [request setHTTPMethod:@"POST"];
+ [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
+ [request setHTTPBody:[CPString JSONFromObject:loginObject]];
+ _loginConnection = [_connectionClass connectionWithRequest:request
+ delegate:self];
+ _loginConnection.username = username;
+}
+
+/* @ignore */
+- (void)_registerUser:(CPString)username password:(CPString)password
+{
+ var shouldRemember = ([_rememberMeButton state] === CPOnState);
+ var registerObject = {'user' : {'email' : username, 'password' : password, 'remember' : shouldRemember}};
+ var request = [CPURLRequest requestWithURL:[[CPBundle mainBundle] objectForInfoDictionaryKey:@"SCAuthRegistrationURL"] || @"/user/"];
+
+ [request setHTTPMethod:@"POST"];
+ [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
+ [request setHTTPBody:[CPString JSONFromObject:registerObject]];
+ _registrationConnection = [_connectionClass connectionWithRequest:request
+ delegate:self];
+ _registrationConnection.username = username;
+}
+
@end
Please sign in to comment.
Something went wrong with that request. Please try again.