1
0
mirror of https://github.com/XFox111/PasswordGeneratorExtension.git synced 2026-07-02 19:52:43 +03:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Michael Gordeev 8a1a2bc009 Minor 1.3 (#6)
- Added more special characters for password
- Increased minimal password length to 6 characters
- Fixed "Do not repeat characters" option
- Now passwords always include all types of characters
2021-03-06 12:16:00 +03:00
Michael Gordeev 5dd5b8876b Updated CI config 2021-03-03 16:52:28 +03:00
Michael Gordeev f142d8c3a6 Minor 1.2 (#5)
- Added option "Do not repeat characters"
- Updated GitHub release template
- Updated CI config
2021-03-03 16:44:06 +03:00
Michael Gordeev 5c3a3ca756 Minor 1.1 (#3)
- Added "Prompt for password length every time before generating" option
- Added "Hide successful password generation message" option
2021-02-26 18:19:07 +03:00
Michael Gordeev 06c59cea41 - Updated CI config
- Added GitHub Release template
2020-11-03 14:13:27 +03:00
Michael Gordeev d7eaec0d68 Updated README.md 2020-10-09 12:00:35 +03:00
9 changed files with 177 additions and 38 deletions
+22
View File
@@ -0,0 +1,22 @@
## What's new
-
## Installation
### From extension webstore (recommended)
- [Google Chrome Webstore](https://chrome.google.com/webstore/detail/jnjobgjobffgmgfnkpkjfjkkfhfikmfl)
- [Microsoft Edge Add-ons Webstore](https://microsoftedge.microsoft.com/addons/detail/manimdhobjbkfpeeehlhhneookiokpbj)
- [Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/easy-password-generator/)
- [GitHub Releases](https://github.com/xfox111/PasswordGeneratorExtension/releases/latest)
Note that version published on these webstores can differ from this release
### Sideloading (for testing purposes only)
1. Download attached archive and unpack it
2. Enable Developers mode on your browser extensions page
3. Click "Load unpacked" button and navigate to the extension root folder (contains `manifest.json`)
4. Done!
*On Firefox you should open manifest file instead of extension's folder
**Note:** If you delete extension folder it will disappear from your browser
_Sideloaded extensions don't replace officially installed ones_
+13 -17
View File
@@ -1,12 +1,8 @@
name: CI
on:
workflow_dispatch:
push:
branches: [ master ]
paths:
# Trigger deploy on manifest change
- 'manifest.json'
release:
types: [published]
jobs:
Firefox:
@@ -21,7 +17,7 @@ jobs:
with:
cmd: build
- name: Sign build
- name: 'Sign & publish'
id: web-ext-sign
uses: kewisch/action-web-ext@v1
with:
@@ -31,20 +27,11 @@ jobs:
apiKey: ${{ secrets.FIREFOX_API_KEY }}
apiSecret: ${{ secrets.FIREFOX_CLIENT_SECRET }}
- name: Publish to Firefox Webstore
uses: trmcnvn/firefox-addon@v1
with:
uuid: passwordgenerator@xfox111.net
xpi: ${{ steps.web-ext-sign.outputs.target }}
manifest: ./manifest.json
api-key: ${{ secrets.FIREFOX_API_KEY }}
api-secret: ${{ secrets.FIREFOX_CLIENT_SECRET }}
- name: Drop artifacts
uses: actions/upload-artifact@v2
with:
name: 'Firefox Artefacts'
path: ${{ steps.web-ext-sign.outputs.target }}
path: ${{ steps.web-ext-build.outputs.target }}
Chrome:
runs-on: ubuntu-latest
@@ -67,6 +54,15 @@ jobs:
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
- name: Upload artifact
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: ./PasswordGenerator.zip
tags: true
draft: false
- name: Drop artifacts
uses: actions/upload-artifact@v2
with:
+4 -5
View File
@@ -1,13 +1,10 @@
# Password generator
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/xfox111/PasswordGeneratorExtension)](https://github.com/xfox111/PasswordGeneratorExtension/releases/latest)
![CI](https://github.com/XFox111/PasswordGeneratorExtension/workflows/CI/badge.svg)
[![Mozilla Add-on](https://img.shields.io/amo/rating/easy-password-generator?label=Firefox%20rating)](https://addons.mozilla.org/firefox/addon/easy-password-generator/)
[![Chrome Web Store](https://img.shields.io/chrome-web-store/users/jnjobgjobffgmgfnkpkjfjkkfhfikmfl?label=Chrome%20Webstore%20downloads)](https://chrome.google.com/webstore/detail/jnjobgjobffgmgfnkpkjfjkkfhfikmfl)
[![Chrome Web Store](https://img.shields.io/chrome-web-store/rating/jnjobgjobffgmgfnkpkjfjkkfhfikmfl)](https://chrome.google.com/webstore/detail/jnjobgjobffgmgfnkpkjfjkkfhfikmfl)
[![Mozilla Add-on](https://img.shields.io/amo/users/easy-password-generator?label=Firefox%20Webstore%20downloads)](https://addons.mozilla.org/firefox/addon/easy-password-generator/)
[![Mozilla Add-on](https://img.shields.io/amo/rating/easy-password-generator)](https://addons.mozilla.org/firefox/addon/easy-password-generator/)
[![Mozilla Add-on](https://img.shields.io/amo/dw/easy-password-generator)](https://addons.mozilla.org/firefox/addon/easy-password-generator/)
[![GitHub issues](https://img.shields.io/github/issues/xfox111/PasswordGeneratorExtension)](https://github.com/xfox111/PasswordGeneratorExtension/issues)
[![GitHub last commit](https://img.shields.io/github/last-commit/xfox111/PasswordGeneratorExtension)](https://github.com/xfox111/PasswordGeneratorExtension/commits/master)
@@ -18,7 +15,7 @@
[![GitHub followers](https://img.shields.io/github/followers/xfox111?label=Follow%20@xfox111&style=social)](https://github.com/xfox111)
[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-%40xfox111-orange)](https://buymeacoffee.com/xfox111)
![Password generator](https://xfox111.net/1cj439)
![Password generator](https://xfox111.net/ma4rop)
Extension for web browsers which helps you to easily generate strong passwords in one click
@@ -28,6 +25,8 @@ Extension for web browsers which helps you to easily generate strong passwords i
- Clean and simple UI
- Dark mode
![Password generator demo](https://xfox111.net/1cj439)
## Download
- [Google Chrome Webstore](https://chrome.google.com/webstore/detail/jnjobgjobffgmgfnkpkjfjkkfhfikmfl)
- [Microsoft Edge Add-ons Webstore](https://microsoftedge.microsoft.com/addons/detail/manimdhobjbkfpeeehlhhneookiokpbj)
+25
View File
@@ -29,6 +29,16 @@
"message": "Invalid generator settings. No password was generated",
"description": "Message which is shown after a creation of password failed"
},
"notEnoughChars":
{
"message": "With your current settings, your password length should not exceed %MIN_CHARS% characters",
"description": "Message which is shown if there's no enough characters to create a password"
},
"lengthPrompt":
{
"message": "Set password length. Press OK to use default password length (%LEN% characters)",
"description": "A prompt message when user generates a password"
},
"generatorOptions":
{
@@ -75,6 +85,11 @@
"message": "Exclude ambiguous characters (e.g.",
"description": "Option checkbox label"
},
"dontRepeatChars":
{
"message": "Do not repeat characters",
"description": "Option checkbox label"
},
"extOptions":
{
@@ -91,6 +106,16 @@
"message": "Add \"Generate password\" action to context menu",
"description": "Option checkbox label"
},
"hideAlert":
{
"message": "Hide successful password generation message",
"description": "Option checkbox label"
},
"promptForLength":
{
"message": "Prompt for password length every time before generating",
"description": "Option checkbox label"
},
"more":
{
"message": "More",
+25
View File
@@ -29,6 +29,16 @@
"message": "Установлены неправильные настройки генератора. Ничего не было сгенерировано",
"description": "Message which is shown after a creation of password failed"
},
"notEnoughChars":
{
"message": "При текущих параметрах длина создаваемого пароля должна быть не больше %MIN_CHARS% знаков",
"description": "Message which is shown if there's no enough characters to create a password"
},
"lengthPrompt":
{
"message": "Укажите длину пароля. Нажмите ОК чтобы использовать длину по умолчанию (%LEN% символов)",
"description": "A prompt message when user generates a password"
},
"generatorOptions":
{
@@ -75,6 +85,11 @@
"message": "Исключить специальные символы (например:",
"description": "Option checkbox label"
},
"dontRepeatChars":
{
"message": "Не повторять символы",
"description": "Option checkbox label"
},
"extOptions":
{
@@ -91,6 +106,16 @@
"message": "Добавить действие \"Сгенерировать пароль\" в контекстное меню браузера",
"description": "Option checkbox label"
},
"hideAlert":
{
"message": "Не показывать сообщение при генерации пароля",
"description": "Option checkbox label"
},
"promptForLength":
{
"message": "Спрашивать длину пароля перед генерацией",
"description": "Option checkbox label"
},
"more":
{
"message": "Больше",
+16 -7
View File
@@ -10,10 +10,13 @@ chrome.storage.sync.get(
includeUppercase: true,
excludeSimilar: true,
excludeSpecial: true,
dontRepeatChars: false,
// Extension settings
showButton: true,
showContext: true
showContext: true,
hideAlert: false,
promptForLength: false
},
(settings) =>
{
@@ -30,9 +33,12 @@ chrome.storage.sync.get(
"includeUppercase",
"excludeSimilar",
"excludeSpecial",
"dontRepeatChars",
"showButton",
"showContext"
"showContext",
"hideAlert",
"promptForLength"
].forEach(i => document.querySelector("#" + i).checked = settings[i]);
SetupEventHandlers();
@@ -43,22 +49,25 @@ chrome.storage.sync.get(
function SetupEventHandlers()
{
document.querySelectorAll("input").forEach(i =>
i.addEventListener("input",
() => chrome.storage.sync.set(JSON.parse("{ \"" + i.id + "\": " + (i.type == "checkbox" ? i.checked : i.value) + " }"))));
i.addEventListener(
"input",
() => chrome.storage.sync.set(JSON.parse("{ \"" + i.id + "\": " + (i.type == "checkbox" ? i.checked : i.value) + " }"))
)
);
document.querySelector("#generate").addEventListener("click", () => GeneratePassword(null));
document.querySelector("#generate").addEventListener("click", () => GeneratePassword(null, true));
document.querySelector("#more").addEventListener("click", (s) =>
{
let group = document.querySelector("#about");
if (group.hasAttribute("hidden"))
{
group.removeAttribute("hidden");
s.currentTarget.querySelector("i").textContent = "";
s.currentTarget.querySelector("i").textContent = "\uE010";
}
else
{
group.setAttribute("hidden", "");
s.currentTarget.querySelector("i").textContent = "";
s.currentTarget.querySelector("i").textContent = "\uE011";
}
});
}
+55 -7
View File
@@ -2,7 +2,7 @@
const upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const lowerCase = upperCase.toLowerCase();
const numbers = "1234567890";
const specialCharacters = "@#$%";
const specialCharacters = "!#$%&*+-=?@^_";
const ambiguousCharacters = "{}[]()/\\'\"`~,;:.<>";
const similarCharacters = "il1Lo0O";
@@ -34,7 +34,7 @@ function InsertButtons()
});
}
function GeneratePassword(e)
function GeneratePassword(e, useDefaultLength = false)
{
// Generating password
let availableCharacters = ""; // Set of available characters to generate a password from
@@ -47,7 +47,10 @@ function GeneratePassword(e)
includeLowercase: true,
includeUppercase: true,
excludeSimilar: true,
excludeSpecial: true
excludeSpecial: true,
hideAlert: false,
promptForLength: false,
dontRepeatChars: false,
},
(settings) =>
{
@@ -71,9 +74,44 @@ function GeneratePassword(e)
return;
}
let password = "";
for (k = 0; k < settings.length; k++)
password += availableCharacters[GetRandomInt(0, availableCharacters.length)]; // Picking random characters
var pwdLength = settings.length;
if (settings.promptForLength && !useDefaultLength)
while(true)
{
var response = prompt(chrome.i18n.getMessage("lengthPrompt").replace("%LEN%", settings.length));
if (response === null) // If user clicked 'Cancel'
return;
if (parseInt(response) && response >= 6)
{
pwdLength = response;
break;
}
else if (!response) // Continue with default length if no response is provided. Try again if input is invalid
break;
}
if (settings.dontRepeatChars && availableCharacters.length < pwdLength)
{
alert(chrome.i18n.getMessage("notEnoughChars").replace("%MIN_CHARS%", availableCharacters.length));
return;
}
do
{
var password = "";
var leftCharacters = availableCharacters;
for (k = 0; k < pwdLength; k++)
{
password += leftCharacters[GetRandomInt(0, leftCharacters.length)]; // Picking random characters
if (settings.dontRepeatChars)
leftCharacters = leftCharacters.replace(password[k], "");
}
}
while (!((!settings.includeSymbols || ContainsAny(password, specialCharacters)) &&
(!settings.includeNumbers || ContainsAny(password, numbers)) &&
(!settings.includeLowercase || ContainsAny(password, lowerCase)) &&
(!settings.includeUppercase || ContainsAny(password, upperCase))));
let field = e?.target.previousElementSibling;
// Creating a hidden field if called as standalone
@@ -97,7 +135,8 @@ function GeneratePassword(e)
if (!e)
field.remove();
alert(chrome.i18n.getMessage("success"));
if (settings.hideAlert === false)
alert(chrome.i18n.getMessage("success"));
});
}
@@ -105,4 +144,13 @@ function GeneratePassword(e)
function GetRandomInt(min, max)
{
return Math.floor(Math.random() * (max - min)) + min;
}
function ContainsAny(array1, array2)
{
for(var k = 0; k < array2.length; k++)
if (array1.includes(array2[k]))
return true;
return false;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "__MSG_name__",
"version": "1.0",
"version": "1.3",
"manifest_version": 2,
"description": "__MSG_description__",
"author": "__MSG_author__",
+16 -1
View File
@@ -20,7 +20,7 @@
<h2 loc="generatorOptions">Generator options</h2>
<div class="group">
<label for="length" style="margin: 5px 0px;"><b loc="length">Password length</b></label>
<input id="length" type="number" />
<input id="length" type="number" min="6"/>
<label><span loc="hint">Reccommended password length:</span> <b>16-32</b></label>
</div>
<div class="group">
@@ -54,6 +54,11 @@
<span class="mark"></span>
<span><span loc="excludeSpecial">Exclude ambiguous characters (e.g.</span> { } [ ] ( ) / \ ' " ` ~ , ; : . &lt; &gt;)</span>
</label>
<label class="checkbox control">
<input id="dontRepeatChars" type="checkbox" />
<span class="mark"></span>
<span><span loc="dontRepeatChars">Do not repeat characters</span>
</label>
</div>
<h2 loc="extOptions">Extension options</h2>
@@ -68,6 +73,16 @@
<span class="mark"></span>
<span loc="showContext">Add "Generate password" action to context menu</span>
</label>
<label class="checkbox control">
<input id="hideAlert" type="checkbox" />
<span class="mark"></span>
<span loc="hideAlert">Hide successful password generation message</span>
</label>
<label class="checkbox control">
<input id="promptForLength" type="checkbox" />
<span class="mark"></span>
<span loc="promptForLength">Prompt for password length every time before generating</span>
</label>
</div>
<div style="margin-bottom: 10px;">