Browse Source

Force site to be defined in Android application

In order to be consistent with all other implementations, we need to disable the generate button if site empty.

Fixes https://github.com/lesspass/lesspass/issues/388
pull/410/head
Guillaume Vincent 5 years ago
parent
commit
be92dc4862
3 changed files with 22 additions and 3 deletions
  1. +1
    -1
      mobile/package.json
  2. +5
    -2
      mobile/src/password/validations.js
  3. +16
    -0
      mobile/src/password/validations.test.js

+ 1
- 1
mobile/package.json View File

@@ -1,6 +1,6 @@
{
"name": "lesspass-mobile",
"version": "3.1.2",
"version": "3.1.3",
"description": "LessPass mobile application",
"license": "(MPL-2.0 OR GPL-3.0)",
"author": {


+ 5
- 2
mobile/src/password/validations.js View File

@@ -22,9 +22,12 @@ export function areOptionsValid(options) {
}

export function isProfileValid(profile) {
const { options } = profile;
const { site, options } = profile;
const { length, counter } = options;
return (
isLengthValid(length) && isCounterValid(counter) && areOptionsValid(options)
isLengthValid(length) &&
isCounterValid(counter) &&
areOptionsValid(options) &&
site !== ""
);
}

+ 16
- 0
mobile/src/password/validations.test.js View File

@@ -98,6 +98,22 @@ describe("validation", () => {
symbols: true
}
})
).toBe(false);
});
it("with only site", () => {
expect(
isProfileValid({
site: "lesspass",
login: "",
options: {
length: 16,
counter: 1,
lowercase: true,
uppercase: true,
digits: true,
symbols: true
}
})
).toBe(true);
});
it("no options", () => {


Loading…
Cancel
Save