Jump to content

limit login attempts

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
frankietook

frankietook

    Newbie

  • Members
  • Pip
  • 1 posts
hi how do i change this code to limit user attempts to 3?

public void validateUser(String name, String password) {
if (name.equals("admin") && password.equals("letmein")) {
display.setCurrent(list1);
} else {
tryAgain();
}
}
public void tryAgain() {
Alert error = new Alert("Login Incorrect", "Please try again", null, AlertType.ERROR);

Many Thanks

#2
Roman Y

Roman Y

    Programmer

  • Members
  • PipPipPipPip
  • 189 posts
I'm not that great at that area so I can't provide you with the code or something but sounds to me, like two loops one is while(true) and the other one is for loop limited with to three tries inside the while loop after wich comes a timer function (depending on how long you want to wait before it allows to try again).

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
The way I do it is to track the number of attempts in a database, clearing the count on a successful login.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
Roman Y

Roman Y

    Programmer

  • Members
  • PipPipPipPip
  • 189 posts
yeah that's probably the best way, saw how much there is can go wrong with suggestion in my post but unfortunatly I can't delete it... hehe