Where in the login process would I place code to set username before begin login with the delegate function
- (BOOL)logInViewController:(PFLogInViewController *)logInController
shouldBeginLogInWithUsername:(NSString *)username
password:(NSString *)password
The think is i need unique usernames for my b2b app; which is for differents companies and this companies could have the same usernames. From the above, i set the username in pfuser to "company id"+"_"+"user id", and because that i try to set entered username by user on PFLogInViewController for login validation.
I make a custom subclass of PFLogInViewController:
#import "PFLogInViewControllerFSB.h"
@interface PFLogInViewControllerFSB ()
@end
@implementation PFLogInViewControllerFSB
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
UIColor *color = [UIColor lightGrayColor];
self.logInView.usernameField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"login_txt_user", @"Generales",nil) attributes:@{NSForegroundColorAttributeName: color}];
self.logInView.passwordField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"login_txt_password", @"Generales",nil) attributes:@{NSForegroundColorAttributeName: color}];
self.logInView.logo = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];
UILabel *labelLogo = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];
labelLogo.text = @"Catch Sales";
[labelLogo setTextAlignment:NSTextAlignmentCenter];
[labelLogo setTextColor:[UIColor lightGrayColor]];
[labelLogo setFont:[UIFont fontWithName:@"Helvetica" size:30]];
[self.logInView.logo addSubview:labelLogo];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@end