Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,

I have some idea how to code to login facebook users. But I want to only accept users from certain colleges. I know schools have their own Facebook accounts students sign in through. I thought I could adjust the code below some how? Or maybe I can use some thing like
Pascal
if emailString.rangeOfString("@collge.KSU.edu") == nil { print("Must be KSU email.") }

which isn't secure but it would allow a filter.


C#
- (void)_loginWithFacebook {
    // Set permissions required from the facebook user account
    NSArray *permissionsArray = @[ @"user_about_me", @"user_relationships", @"user_birthday", @"user_location"];

    // Login PFUser using Facebook
    [PFFacebookUtils logInInBackgroundWithReadPermissions:permissionsArray block:^(PFUser *user, NSError *error) {
      if (!user) {
        NSLog(@"Uh oh. The user cancelled the Facebook login.");
      } else if (user.isNew) {
        NSLog(@"User signed up and logged in through Facebook!");
      } else {
        NSLog(@"User logged in through Facebook!");
      }
    }];
}
Posted
Comments
Sergey Alexandrovich Kryukov 6-Dec-15 22:09pm    
Bad idea. Anyone can represent herself/himself as a student of certain college. Either implement access to anyone or introduce personal accounts. Don't forget that you can use such option as OpenID.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900