meyrett
Posts: 0
Joined: Sun Mar 25, 2012 10:31 pm

Making a password screen?

var username = Tiggr('mobiletextinput1').val();
var password = Tiggr('mobiletextinput2').val();

if (username != 'user' && password != 'pass'){
alert ('Incorrect username and password.');
return;
}

Doing exactly this gives an interesting result:
With this configuration, as long as the username is right, it doesnt matter what the password is...... you will be put through to home page. With this configuration, you have to get both username and password both wrong to be blocked and receive the "incorrect username and password".

Of course, I want to make sure they put in the right username and right password or they should receive the "incorrect username and password" message.

thanks so much.
this is 99% there. I'm thrilled and appreciative.

Best

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Making a password screen?

It works for me. If I enter anything but 'user' and 'pass', I get the alert. Otherwise, I navigate to the 2nd page.

meyrett
Posts: 0
Joined: Sun Mar 25, 2012 10:31 pm

Making a password screen?

Odd.
I just tested it on the emulator and on my smartphone. It lets me through as long as I get one right (un or password).
are we sure there should be a double && in there?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Making a password screen?

Sorry, it has to be:

code
if (username != 'user' || password != 'pass')
/code

It's OR, not AND.

meyrett
Posts: 0
Joined: Sun Mar 25, 2012 10:31 pm

Making a password screen?

IT WORKS!
Thanks so much.

nazario
Posts: 0
Joined: Wed Jun 20, 2012 3:10 am

Making a password screen?

Ok, So I have a login page that sends information back to a PHP script that checks to make sure that the password combo is correct. How do I enforce / prevent people from getting to screens without first logging in?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Making a password screen?

That has to be part of your app logic. You need to get some id from the server when user logs in and save it for subsequent requests. As long as the id is valid, the user is logged in.

nazario
Posts: 0
Joined: Wed Jun 20, 2012 3:10 am

Making a password screen?

I understand that. Currently, when a valid username password combination is submitted, a JSON representation of the logged in user is returned along with first, last name, and UID. My question is what is the best mechanism to keep a session between screens and therefor prevent from landing on a screen without proper credentials.
Along the same lines as your suggestion about a valid ID, I've thought about holding the JSON object (along with the ID) in some local tiggzi variable to then perform logic on it. If this is the best way, I have no clue how to do it :D
As of now, all the logic has been done on the back end in PHP wich means not as snappy interface for the user. If you have a suggestion as to how I should do this, I would appreciate it!

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Making a password screen?

Yes, one way is to save the ID in browser's local storage.

http://help.tiggzi.com/documentation/...

nazario
Posts: 0
Joined: Wed Jun 20, 2012 3:10 am

Making a password screen?

Oh thank you. I was looking for something like this but couldn't find it. It's a great start. I am sure I'll get stuck some place.
Thanks again!

Return to “Issues”