Objective -C Password Score Thingy


/ Published in: Objective C
Save to your folder(s)

Just a random snippet of text nothing special.


Copy this code and paste it in your HTML
  1. -(IBAction) workOutPasswordsRating:(id)sender;
  2. {
  3. // Get the current property from the _passwordRating.
  4. NSInteger currentRating;
  5. currentRating = _passwordRating;
  6.  
  7. NSInteger complexityChoice;
  8. complexityChoice = [_passwordComplexity indexOfSelectedItem];
  9.  
  10. // We need to check to see if anything has been previously set.
  11. if (_lastAssignedScore != 0) {
  12. // Something was previously set, so deduct that.
  13. NSInteger tmp = 0;
  14. if (tmp < 0) {
  15. _passwordRating = 0;
  16. } else {
  17. _passwordRating -= _lastAssignedScore;
  18. }
  19.  
  20. [_complexityBar setIntegerValue:_passwordRating];
  21. }
  22.  
  23. if (complexityChoice == 0) {
  24. _passwordRating += 2;
  25. [_complexityBar setIntegerValue:_passwordRating];
  26. _lastAssignedScore = 2;
  27. } else if (complexityChoice == 1) {
  28. _passwordRating += 1;
  29. [_complexityBar setIntegerValue:_passwordRating];
  30. _lastAssignedScore = 1;
  31. } else if (complexityChoice == 2) {
  32. _passwordRating += 0;
  33. [_complexityBar setIntegerValue:_passwordRating];
  34. _lastAssignedScore = 0;
  35. }
  36.  
  37. NSLog(@"CURRENT SCORE: %ld", _passwordRating);
  38.  
  39. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.