Skip to content

Commit

Permalink
[FEATURE] Verificación repeticiones caracteres (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
JSalmon11 authored Jun 24, 2023
1 parent 7a21529 commit 9838130
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## [1.2.0] - 2023-06-24
### Added
- Added verification not to repeat characters more than 2 times when generating the password.
- Added check not to repeat consecutive identical characters.
- Added verification to not repeat consecutive uppercase characters.
- Added check not to repeat consecutive lowercase characters.
- Added verification not to repeat consecutive numeric characters.

## [1.1.1] - 2022-03-12
### Fixed
- Fixed button to check available updates.
Expand All @@ -16,6 +24,7 @@
## [1.0.0] - 2022-04-08
- Initial release

[1.2.0]: https://github.com/JSalmon11/Generador-de-Contrasenias/compare/1.1.1...1.2.0
[1.1.1]: https://github.com/JSalmon11/Generador-de-Contrasenias/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/JSalmon11/Generador-de-Contrasenias/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/JSalmon11/Generador-de-Contrasenias/compare/b552912c04419d8d2ae5d9fd9bb7f315145f46d8...1.0.0
15 changes: 12 additions & 3 deletions CHANGELOG_es.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# CHANGELOG

## [1.1.1] - 2022-03-12
## [1.2.0] - 24-06-2023
### Añadido
- Añadida verificación para no repetir carácteres más de 2 veces al generar la sontraseña.
- Añadida verificación para no repetir dos carácteres iguales seguidos.
- Añadida verificación para no repetir carácteres mayúscula seguidos.
- Añadida verificación para no repetir carácteres minúscula seguidos.
- Añadida verificación para no repetir carácteres numéricos seguidos.

## [1.1.1] - 12-03-2022
### Arreglado
- Arreglado botón para comprobar actualizaciones.

## [1.1.0] - 2022-04-10
## [1.1.0] - 10-04-2022
### Añadido
- Añadido botón para comprobar actualizaciones.
- Añadido soporte para intenacionalización (es, en, ja).
Expand All @@ -13,9 +21,10 @@
- Controlado error cuando el campo longitud está vacío.


## [1.0.0] - 2022-04-08
## [1.0.0] - 08-04-2022
- Lanzamineto inicial.

[1.2.0]: https://github.com/JSalmon11/Generador-de-Contrasenias/compare/1.1.1...1.2.0
[1.1.1]: https://github.com/JSalmon11/Generador-de-Contrasenias/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/JSalmon11/Generador-de-Contrasenias/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/JSalmon11/Generador-de-Contrasenias/compare/b552912c04419d8d2ae5d9fd9bb7f315145f46d8...1.0.0
2 changes: 1 addition & 1 deletion src/Main/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @author <a href="https://github.com/JSalmon11">Jorge Salmón</a>
*/
public class App extends Application {
private static String version = "1.1.1";
private static String version = "1.2.0";
public static final Idioma idioma = new Idioma(System.getProperty("user.language"));

public static void main(String[] args) {
Expand Down
28 changes: 27 additions & 1 deletion src/Utils/GeneratePass.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,35 @@ public class GeneratePass {
} else {
StringBuilder sb = new StringBuilder(longitud);
char c;
char lastChar = '\u0000'; //lastChar valor null
for (int i = 0; i < sb.capacity(); ++i) {
c = (char) ThreadLocalRandom.current().nextInt(33, 126 + 1);
boolean repeat;
int count;
do {
repeat = false;
count = 0;
c = (char) ThreadLocalRandom.current().nextInt(33, 126 + 1);
for (int j = 0; j < i; j++) {
if (sb.charAt(j) == c) {
count++;
}
if (count >= 2) {
repeat = true;
break;
}
}
if (c == lastChar) {
repeat = true;
} else if (Character.isLetter(c) && Character.isLetter(lastChar)) {
if (Character.isUpperCase(c) == Character.isUpperCase(lastChar)) {
repeat = true;
}
} else if (Character.isDigit(c) && Character.isDigit(lastChar)) {
repeat = true;
}
} while (repeat);
sb.insert(i, c);
lastChar = c;
}
return sb.toString();
}
Expand Down

0 comments on commit 9838130

Please sign in to comment.