Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // AuthenticationViewController.m
- // Authentication
- //
- // Created by Derek Hardison on 5/13/09.
- // Copyright __MyCompanyName__ 2009. All rights reserved.
- //
- #import "AuthenticationViewController.h"
- #import "RCAuth.h"
- #import "RCEventSportAppDelegate.h"
- #import "EventsViewController.h"
- @implementation AuthenticationViewController
- - (void)viewDidLoad {
- appDel = (RCEventSportAppDelegate *) [[UIApplication sharedApplication] delegate];
- // ASSERT: Made connection with application delegate.
- eventsView = [[EventsViewController alloc] initWithNibName:@"EventsMain" bundle:nil];
- // ASSERT: Initialized the next view.
- [[[[[appDel tabBarController] viewControllers] objectAtIndex:0] tabBarItem] setEnabled:NO];
- [[[[[appDel tabBarController] viewControllers] objectAtIndex:1] tabBarItem] setEnabled:NO];
- [[[[[appDel tabBarController] viewControllers] objectAtIndex:2] tabBarItem] setEnabled:NO];
- // ASSERT: Disable all of the tab bar buttons until the user has logged in.
- [super viewDidLoad];
- }
- // PRE: Takes an type 'id'.
- // POST: Returns type 'IBAction' which is essentially void.
- // Submits username and password to validation backend.
- - (IBAction) validateUser:(id) sender {
- RCAuth *rcA = [[RCAuth alloc] initWithUser:[username text] password:[password text]];
- // ASSERT: rcA now contains information about the user's login and password.
- NSLog(@"OK %d", [rcA isLoggedIn]);
- if ([rcA isLoggedIn] == 1) {
- NSLog(@"before res");
- [(UITextField *)sender resignFirstResponder];
- NSLog(@"after res");
- // ASSERT: Remove the keyboard from the screen.
- //[[self navigationController] pushViewController:eventsView animated:YES];
- // ASSERT: Notify the main program that the user has successfully
- // authenticated themselves.
- }
- else {
- [errorLabel setText:@"Invalid username or password."];
- }
- NSLog(@"BEFORE REL");
- [rcA release];
- NSLog(@"After REL");
- }
- - (IBAction) nextField:(id) sender {
- [(UITextField *) password becomeFirstResponder];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
- // Release anything that's not essential, such as cached data
- }
- - (void)dealloc {
- // New memory release calls.
- [username release];
- [password release];
- [errorLabel release];
- [eventsView release];
- [appDel release];
- [super dealloc];
- }
- @end
Add Comment
Please, Sign In to add comment