mirror of
https://github.com/XFox111/PasswordGeneratorExtension.git
synced 2026-04-22 08:08:01 +03:00
Patch 2.0.2 (#53)
* Fix for issue #51 - Extension is not working on firefox (#52) * Fix for issue #51 - Extension is not working on firefox * Fix for issue #51 - Replaced @types/chrome with webextension-polyfill * re-Added @types/chrome to allow development tests * Moved local import after module imports * Bump @types/node from 18.7.18 to 18.11.0 (#48) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.7.18 to 18.11.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @fluentui/react-icons from 2.0.183 to 2.0.185 (#50) Bumps [@fluentui/react-icons](https://github.com/microsoft/fluentui-system-icons) from 2.0.183 to 2.0.185. - [Release notes](https://github.com/microsoft/fluentui-system-icons/releases) - [Commits](https://github.com/microsoft/fluentui-system-icons/commits) --- updated-dependencies: - dependency-name: "@fluentui/react-icons" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eugene Fox <eugene.xfox@outlook.com> * Bump typescript from 4.8.3 to 4.8.4 (#47) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.3 to 4.8.4. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.8.3...v4.8.4) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eugene Fox <eugene.xfox@outlook.com> * Bump @types/jest from 29.1.1 to 29.1.2 (#44) Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 29.1.1 to 29.1.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest) --- updated-dependencies: - dependency-name: "@types/jest" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eugene Fox <eugene.xfox@outlook.com> * Bump @fluentui/react-components from 9.3.2 to 9.5.1 (#49) Bumps [@fluentui/react-components](https://github.com/microsoft/fluentui) from 9.3.2 to 9.5.1. - [Release notes](https://github.com/microsoft/fluentui/releases) - [Changelog](https://github.com/microsoft/fluentui/blob/master/azure-pipelines.release-fluentui.yml) - [Commits](https://github.com/microsoft/fluentui/compare/@fluentui/react-components_v9.3.2...@fluentui/react-components_v9.5.1) --- updated-dependencies: - dependency-name: "@fluentui/react-components" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eugene Fox <eugene.xfox@outlook.com> * - Updated craco.config.ts to improve extension's stability - Renamed manifest.firefox.json to manifest.v2.json - Added fallbacks for invalid password length - Migrated FluentUI Dialog to stable release - Updated WebExt compat API * Updated project formatting * Feedback button now navigates to webstore page * Update code style guidelines * Updated extension version to 2.0.2 * Fixed pipelines * Fixed AboutSection.tsx * Fixed CodeQL issues * Fixed feedback link not working * Fixed feedback button again Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Andry Herizo RAJOELISON <finalherizo@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
+19
-13
@@ -10,21 +10,24 @@ export default class Generator
|
||||
public static AmbiguousCharacters = "{}[]()/\\'\"`~,;:.<>";
|
||||
public static SimilarCharacters = "il1Lo0O";
|
||||
|
||||
public static GeneratePassword(props : GeneratorOptions) : string
|
||||
public static GeneratePassword(props: GeneratorOptions): string
|
||||
{
|
||||
if (!props.Length || isNaN(props.Length) || props.Length < 4)
|
||||
props.Length = 4;
|
||||
|
||||
// Validating parameters
|
||||
if (this.ValidateProps(props))
|
||||
return "";
|
||||
|
||||
// Generating password
|
||||
let availableCharacters : string = this.GetAvailableCharacters(props);
|
||||
let requiredCharacters : string = this.GetRequiredCharacters(props);
|
||||
let availableCharacters: string = this.GetAvailableCharacters(props);
|
||||
let requiredCharacters: string = this.GetRequiredCharacters(props);
|
||||
|
||||
let password : string = "";
|
||||
let password: string = "";
|
||||
|
||||
for (let i = 0; i < props.Length; i++)
|
||||
{
|
||||
let char : string = this.PickRandomFromArray(availableCharacters);
|
||||
let char: string = this.PickRandomFromArray(availableCharacters);
|
||||
|
||||
if (props.ExcludeRepeating && password.includes(char))
|
||||
i--;
|
||||
@@ -43,12 +46,15 @@ export default class Generator
|
||||
return password;
|
||||
}
|
||||
|
||||
public static ValidateProps(props : GeneratorOptions): string
|
||||
public static ValidateProps(props: GeneratorOptions): string
|
||||
{
|
||||
if (!props.Length || isNaN(props.Length) || props.Length < 4)
|
||||
props.Length = 4;
|
||||
|
||||
if (!props.Lowercase && !props.Uppercase)
|
||||
return loc("Either lowercase or uppercase characters must be included");
|
||||
|
||||
let availableCharacters : string = this.GetAvailableCharacters(props);
|
||||
let availableCharacters: string = this.GetAvailableCharacters(props);
|
||||
|
||||
if (props.ExcludeRepeating && availableCharacters.length < props.Length)
|
||||
return loc("Selected length is too long to exclude repeating characters");
|
||||
@@ -56,9 +62,9 @@ export default class Generator
|
||||
return "";
|
||||
}
|
||||
|
||||
private static GetAvailableCharacters(props : GeneratorOptions) : string
|
||||
private static GetAvailableCharacters(props: GeneratorOptions): string
|
||||
{
|
||||
let availableCharacters : string = "";
|
||||
let availableCharacters: string = "";
|
||||
|
||||
if (props.Special)
|
||||
availableCharacters += this.SpecialCharacters;
|
||||
@@ -77,9 +83,9 @@ export default class Generator
|
||||
return availableCharacters;
|
||||
}
|
||||
|
||||
private static GetRequiredCharacters(props : GeneratorOptions) : string
|
||||
private static GetRequiredCharacters(props: GeneratorOptions): string
|
||||
{
|
||||
let requiredCharacters : string = "";
|
||||
let requiredCharacters: string = "";
|
||||
|
||||
if (props.Special)
|
||||
requiredCharacters += this.PickRandomFromArray(this.SpecialCharacters);
|
||||
@@ -100,12 +106,12 @@ export default class Generator
|
||||
|
||||
// See https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/random
|
||||
// min is inclusive, max is exclusive
|
||||
private static GetRandomInt(min : number, max : number) : number
|
||||
private static GetRandomInt(min: number, max: number): number
|
||||
{
|
||||
return Math.floor(Math.random() * (max - min)) + min;
|
||||
}
|
||||
|
||||
private static PickRandomFromArray(array : string) : string
|
||||
private static PickRandomFromArray(array: string): string
|
||||
{
|
||||
return array[this.GetRandomInt(0, array.length)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user