Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6928879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:14:47+00:00 2026-05-27T11:14:47+00:00

I have a login form where the user can login only with the valid

  • 0

I have a login form where the user can login only with the valid memberID and password. If the user enter correct enamel and password i get a result string contains the user information that the user created in the signup process, if it the password is wrong it shows the status 400 as the result string, the result string is the json array which contains one f the above values, one thing is the if the success login occur it gives the staus 200 along with the user information, my need is to retrieve the status message from the array and i need to validate it within the app, if the login success(status 200) it needs to be redirected to the main page; if it is(status 400) it shows a unsuccessful login message.
my code:
EDit

-(IBAction)_clicksbtnsignIN:(id) sender
{
    [_txtmemberId resignFirstResponder];
    [_txtpassword resignFirstResponder];

    NSString *connectionstring =  [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:@"http://www.google.com"]];

    if ([connectionstring length]==0) {
        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"you are not connected to the internet" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
        [alert show];
        [alert release];        
    }       
    else
    {
        //NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        NSString *emailString = _txtmemberId.text; // storing the entered email in a string.            
        // Regular expression to checl the email format.

        NSString *emailReg = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";

        NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailReg];
        //[pool drain];

        if (_txtmemberId.text.length == 0  || _txtpassword.text.length == 0) {
            UIAlertView *alertblnk = [[UIAlertView alloc]initWithTitle:@"ALERT" message:@"Fill the required text fields" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];

            [alertblnk show];

            [alertblnk release];
        }
        if (([emailTest evaluateWithObject:emailString] != YES) || [emailString isEqualToString:@""])
        {
            UIAlertView *loginalert = [[UIAlertView alloc] initWithTitle:@" Alert" message:@"Invalid Email ID" delegate:self
                                                       cancelButtonTitle:@"OK" otherButtonTitles:nil];

            [loginalert show];

            [loginalert release];
        } 
        else {

            [_spinner startAnimating];

            NSString *uname = _txtmemberId.text;

            NSString *pwd   = _txtpassword.text;

            NSString *urlVal = @"http://dev.eltouchapps.net/api/?app=1&type=m1&action=t2&var1=";

            NSString *urlVal1 = [urlVal stringByAppendingString:uname];

            NSString *urlVal2 = [urlVal1 stringByAppendingString:@"&var2="];

            NSString *urlVal3 = [urlVal2 stringByAppendingString:pwd];              

            NSString * encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)urlVal3,NULL,               (CFStringRef)@"\n" "",kCFStringEncodingUTF8 );
            NSURL *url = [NSURL URLWithString:encodedString];

            NSString *resultString = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];

            UIAlertView *loginalert = [[UIAlertView alloc] initWithTitle:@" Message" message:resultString delegate:self
                                                       cancelButtonTitle:@"OK" otherButtonTitles:nil];

            [loginalert show];                
           [loginalert release];

            lblresult.text = resultString;
            NSString *responseString = [resultString responseString]; 
            NSLog(@"Got Profile: %@", responseString); 

            NSMutableDictionary *responseJSON = [responseString JSONValue]; 
            NSString *firstName;
            if ([[responseJSON valueForKey:@"Status"] isEqualToString:@"200"]) // if success
            {

                ParallelReadViewController *detailViewController = [[ParallelReadViewController alloc] initWithNibName:@"ParallelReadViewController" bundle:nil];

                //detailViewController.firstString = firstString;
                // ...
                // Pass the selected object to the new view controller.

                [self.navigationController pushViewController:detailViewController animated:YES];

                [detailViewController release];
                // do something
                firstName = [responseJSON valueForKey:@"FirstName"];
            }
            }   
}
}

Result string is why i get from the server. I know there is parsing of JSONB array we want , but i didn’t know how to done this.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:14:48+00:00Added an answer on May 27, 2026 at 11:14 am

    based on assumption of your response , try below code

        NSString *resultString = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];        
        NSMutableDictionary *responseJSON = (NSMutableDictionary *)[responseString JSONValue]; 
        NSString *firstName;
        if ([[responseJSON valueForKey:@"Status"] isEqualToString:@"200"]) // if success
        {
            // do something
            firstName = [responseJSON valueForKey:@"FirstName"];
        }
    

    Hope it gives you an idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a login form that has Username and password as inputs from user
I have a child page LoginContent.aspx which contains a login form. If the user
I have a page which displays a form that a logged-in user can use
I have a login form in every page of a website so the user
I have simple login form in my website. In given requirements stands, that password
I have a login form which appears at the top of all of my
I have a login form for my website. This login form have two text
on my web site I want to have login/registration form in modal window done
I have a usual login form consisting of two input fields, one for login,
There are some HTML based games (ie bootleggers.us) that have a simple login form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.