Giter Club home page Giter Club logo

passnpingenerator's Introduction

KwiatekMiki

passnpingenerator's People

Contributors

kwiatekmiki avatar

Stargazers

 avatar

Watchers

 avatar

passnpingenerator's Issues

[Suggestion] Implement support for additional languages

The current implementation of the program supports English, Polish, and Spanish translations. However, it would be beneficial to provide support for additional languages to make the program more accessible to users from different linguistic backgrounds.

Implementation Details:

  1. Create translation files for additional languages in the lang folder, following the same JSON structure as the existing translation files (en.json, pl.json, es.json).
  2. Modify the code to dynamically load the translation file based on the user's Windows language code. If a translation file for the user's language is not found, fallback to the English translation.
  3. Update the program's user interface to display the translated menu options, prompts, and messages based on the selected language.

Expected Benefits:

  • Enhanced user experience by providing support for multiple languages.
  • Increased accessibility for users from different linguistic backgrounds.
  • Improved usability and usability for a wider audience.

Additional Context:
Expanding the language support of the program can attract a broader user base and make it more user-friendly for non-English speakers. This enhancement demonstrates a commitment to inclusivity and user satisfaction.

[Bug] Missing raise keyword when translation file is not found

When the translation file for the user's Windows language is not found, the program prints a message but does not raise a FileNotFoundError exception. This can lead to incorrect behavior when the translations are missing.

Steps to Reproduce:

  1. Run the program without the translation file for the user's Windows language.
  2. Observe the program output.

Expected Behavior:
If the translation file for the user's Windows language is not found, the program should raise a FileNotFoundError exception.

Actual Behavior:
The program prints a message but does not raise an exception, resulting in missing translations and potentially incorrect program behavior.

Additional Information:

  • Operating System: Windows 10
  • Language: English
  • Version: 1.0

Incorrect clear screen command

The clearthis function in the password generator code uses the os.system function with a string 'cls, clear', which is not a valid command on most systems. This can cause the code to break or produce unexpected results.

The solution is to replace it with either os.system('cls') or os.system('clear'), depending on the operating system being used.

Steps to Reproduce:

Run the password generator code on a system that uses either the 'cls' or 'clear' command.
Observe the error caused by the incorrect clear screen command.

Expected Result:

The screen should be cleared without any errors.

Actual Result:

The code raises an error because the clear screen command is not valid.

[Suggestion] Improve code readability with helper functions

The code could be made more readable and modular by using helper functions for certain repetitive tasks. By encapsulating these tasks into functions, the main code can become more concise and easier to understand.

Implementation Details:

  1. Create a helper function load_chars_file to handle the loading of the chars.txt file. This function should return the contents of the file as a string.
  2. Create a helper function load_translation_file to handle the loading of translation files based on the user's Windows language. This function should take the language code as a parameter and return the parsed JSON data.
  3. Refactor the code in the main section to use the helper functions. Instead of manually opening and reading the chars.txt file, call the load_chars_file function. Similarly, instead of manually opening and parsing the translation file, call the load_translation_file function with the appropriate language code.
  4. Update the error handling in the main section to properly handle file not found errors and raise the appropriate exceptions.

Expected Benefits:

  • Improved code readability and maintainability.
  • Modular code structure with reusable helper functions.
  • Better error handling and exception raising.

Additional Context:
The proposed changes will make the code more organized and easier to maintain, especially when dealing with file operations and language translations. By encapsulating these tasks into functions, it will also make it easier to modify or extend these functionalities in the future.

[Bug] Incorrect validation of password/PIN length

The program does not correctly validate the length of the password or PIN entered by the user. It allows lengths outside the specified range (4-100 for passwords and 4-10 for PINs) to be accepted without raising an error.

Steps to Reproduce:

  1. Choose to generate a password or PIN.
  2. Enter a length that is outside the specified range.
  3. Observe the program's response.

Expected Behavior:
If the user enters a length that is outside the specified range, the program should raise a ValueError and display an error message.

Actual Behavior:
The program accepts lengths outside the specified range without raising an error, potentially leading to unexpected results.

Additional Information:

  • Operating System: Windows 10
  • Language: English
  • Version: 1.0

[Bug] Error when translation file is missing

When the translation file for the user's Windows language is missing, the program prints a message but does not raise an exception, causing the program to continue executing with missing translations.

Steps to Reproduce:

Run the program without the translation file for the user's Windows language.
Observe the program output.
Expected Behavior:
If the translation file for the user's Windows language is missing, the program should raise a FileNotFoundError exception.

Actual Behavior:
The program prints a message but does not raise an exception, resulting in missing translations and potentially incorrect program behavior.

Additional Information:

Operating System: Windows 10
Language: English
Version: 1.0

Strengthening the password generator

The current code uses the secrets module to generate random numbers, but it does not utilize the module to its full potential. The password generator should include a mix of different characters, such as special characters, to make the generated passwords stronger and to make them more secure.

[Suggestion] Simplify password and PIN generation logic

The current logic for generating passwords and PINs can be simplified and made more concise by utilizing Python's built-in functions and libraries.

Implementation Details:

  1. Instead of using a loop to generate passwords and PINs character by character, utilize the secrets.choice() function to randomly select characters from the chars string.
  2. Use the secrets.token_urlsafe() function to generate a secure random URL-safe string of the desired length for passwords. This function eliminates the need for the loop and ensures secure random generation.
  3. Update the code to utilize the secrets.token_hex() function for generating PINs. This function generates a random hexadecimal string, which can be converted to a PIN by extracting the desired number of digits.
  4. Remove the strtoint() and checklen() functions, as the built-in functions and libraries handle the length validation automatically.

Expected Benefits:

  • Simplified and more concise code for password and PIN generation.
  • Improved security by utilizing built-in functions for secure random generation.
  • Elimination of custom length validation functions.

Additional Context:
By utilizing the built-in functions and libraries, the code for password and PIN generation can be simplified and made more secure. This approach also reduces the chance of introducing errors or vulnerabilities in custom implementation.

Input validation not implemented in password generator

Description

The code for the password generator does not validate the input provided by the user, which could lead to unexpected results.

Steps to reproduce

  1. Run the password generator code
  2. Enter a value for "What do you want to receive?" that is not one of the expected values (P, p, I, i, N, or n)

Expected result

The user should only be able to enter one of the expected values (P, p, I, i, N, or n)

Actual result

The code accepts any input, which could lead to unexpected results.

Solution

Validate the input provided by the user to ensure that it is one of the expected values.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.