Parcourir la 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 il y a 5 ans
Parent
révision
be92dc4862
3 fichiers modifiés avec 22 ajouts et 3 suppressions
  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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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", () => {


Chargement…
Annuler
Enregistrer