Allow configuring default username (#51)
This commit is contained in:
13
README.md
13
README.md
@@ -92,7 +92,7 @@ Browserpass was designed with an assumption that certain conventions are being f
|
||||
|
||||
1. Password must be defined on a line starting from `password:`, `pass:` or `secret:` (case-insensitive), and if all of these are absent, the first line in the password entry file is considered to be a password.
|
||||
|
||||
1. Username must be defined on a line starting from `login:`, `username:`, `user:` or `email:` (case-insensitive), and if all of these are absent, the file name is considered to be a username.
|
||||
1. Username must be defined on a line starting from `login:`, `username:`, `user:` or `email:` (case-insensitive), and if all of these are absent, default username as configured in browser extension or in `.browserpass.json` of specific password store, and finally if everything is absent the file name is considered to be a username.
|
||||
|
||||
1. URL ([only](#password-matching-and-sorting) used for [basic HTTP auth](#basic-http-authentication)!) must be defined on a line starting from `url:`, `uri:`, `website:`, `site:`, `link:` or `launch:` (case-insensitive).
|
||||
|
||||
@@ -166,6 +166,7 @@ The list of available options:
|
||||
| Name | Description |
|
||||
| ----------------------------------------------------------- | ------------------------------------------------------------ |
|
||||
| Automatically submit forms after filling (aka `autoSubmit`) | Make Browserpass automatically submit the login form for you |
|
||||
| Default username (aka `username`) | Username to use when it's not defined in password entry |
|
||||
| Custom gpg binary (aka `gpgPath`) | Path to a custom `gpg` binary to use |
|
||||
| Custom store locations | List of password stores to use |
|
||||
|
||||
@@ -173,13 +174,15 @@ Browserpass allows configuring certain settings in different places places using
|
||||
|
||||
1. Options defined in specific `*.gpg` files, only apply to these password entries:
|
||||
- `autoSubmit`
|
||||
1. Options defined in browser extension options:
|
||||
- Automatically submit forms after filling (aka `autoSubmit`)
|
||||
- Custom gpg binary (aka `gpgPath`)
|
||||
- Custom store locations
|
||||
1. Options defined in `.browserpass.json` file located in the root of a password store:
|
||||
- `autoSubmit`
|
||||
- `gpgPath`
|
||||
- `username`
|
||||
1. Options defined in browser extension options:
|
||||
- Automatically submit forms after filling (aka `autoSubmit`)
|
||||
- Default username (aka `username`)
|
||||
- Custom gpg binary (aka `gpgPath`)
|
||||
- Custom store locations
|
||||
|
||||
## Security
|
||||
|
||||
|
@@ -13,7 +13,8 @@ var defaultSettings = {
|
||||
autoSubmit: false,
|
||||
gpgPath: null,
|
||||
stores: {},
|
||||
foreignFills: {}
|
||||
foreignFills: {},
|
||||
username: null
|
||||
};
|
||||
|
||||
var authListeners = {};
|
||||
@@ -735,7 +736,8 @@ async function parseFields(settings, login) {
|
||||
if (key == "secret" && lines.length) {
|
||||
login.fields.secret = lines[0];
|
||||
} else if (key == "login") {
|
||||
login.fields[key] = login.login.match(/([^\/]+)$/)[1];
|
||||
const defaultUsername = getSetting("username", login, settings);
|
||||
login.fields[key] = defaultUsername || login.login.match(/([^\/]+)$/)[1];
|
||||
} else {
|
||||
delete login.fields[key];
|
||||
}
|
||||
|
@@ -50,7 +50,8 @@ function view(ctl, params) {
|
||||
var nodes = [];
|
||||
nodes.push(m("h3", "Basic settings"));
|
||||
nodes.push(createCheckbox.call(this, "autoSubmit", "Automatically submit forms after filling"));
|
||||
nodes.push(createInput.call(this, "gpgPath", "Custom gpg binary"));
|
||||
nodes.push(createInput.call(this, "username", "Default username", "john.smith"));
|
||||
nodes.push(createInput.call(this, "gpgPath", "Custom gpg binary", "/path/to/gpg"));
|
||||
|
||||
nodes.push(m("h3", "Custom store locations"));
|
||||
nodes.push(
|
||||
@@ -105,15 +106,16 @@ function view(ctl, params) {
|
||||
*
|
||||
* @param string key Settings key
|
||||
* @param string title Settings title
|
||||
* @param string placeholder Settings placeholder
|
||||
* @return Vnode
|
||||
*/
|
||||
function createInput(key, title) {
|
||||
function createInput(key, title, placeholder) {
|
||||
return m("div.option", { class: key }, [
|
||||
m("label", [
|
||||
title,
|
||||
m("input[type=text]", {
|
||||
value: this.settings[key],
|
||||
placeholder: "/path/to/gpg",
|
||||
placeholder: placeholder,
|
||||
onchange: e => {
|
||||
this.settings[key] = e.target.value;
|
||||
this.saveEnabled = true;
|
||||
|
@@ -53,7 +53,7 @@ h3:first-child {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.option.gpgPath input[type="text"] {
|
||||
.option input[type="text"] {
|
||||
background-color: white;
|
||||
color: black;
|
||||
border: none;
|
||||
@@ -68,16 +68,7 @@ h3:first-child {
|
||||
}
|
||||
|
||||
.option.custom-store input[type="text"] {
|
||||
background-color: white;
|
||||
color: black;
|
||||
border: none;
|
||||
border-bottom: 1px solid #aaa;
|
||||
border-radius: 0;
|
||||
min-height: 0px;
|
||||
height: 21px;
|
||||
margin: -4px 0 0 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user