Advertisement
Raizekas

Untitled

Apr 1st, 2021
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. package uzduotys;
  2.  
  3. public class PenktaUzduotis
  4. {
  5. public int patikrintiUser(String userName, String password)
  6. {
  7. int ats;
  8.  
  9. boolean arTuriSkaiciu = password.matches(".*\\d.*");
  10. boolean arTuriDidziaja = password.matches(".*[A-Z].*");
  11.  
  12.  
  13.  
  14.  
  15.  
  16. if (userName.equals("") && password.equals(""))
  17. {
  18. return -3;
  19. }
  20. else
  21. {
  22. if (userName.equals(""))
  23. {
  24. return -2;
  25. }
  26. else
  27. {
  28. if (userName.equals(""))
  29. {
  30. return -1;
  31. }
  32. else
  33. {
  34. if (password.length() < 8)
  35. {
  36. return -4;
  37. }
  38. else
  39. {
  40. if (!arTuriSkaiciu)
  41. {
  42. return -5;
  43. }
  44. else
  45. {
  46. if (!arTuriDidziaja)
  47. {
  48. return -6;
  49. }
  50. else
  51. {
  52. return 1;
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement