Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"flatpickr": "^4.5.2",
"lodash": "^4.17.11",
"ovh-ui-angular": "^2.23.0",
"ovh-ui-kit": "^2.23.0"
"ovh-ui-kit": "^2.23.0",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"autoprefixer": "^9.2.1",
Expand Down
2 changes: 2 additions & 0 deletions src/ovh-ui-angular/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import fieldController from "./field.controller";
import inlineAdderController from "./inline-adder.controller";
import navbarController from "./navbar.controller";
import paginationController from "./pagination.controller";
import passwordController from "./password.controller";
import progressController from "./progress.controller";
import searchController from "./search.controller";
import selectController from "./select.controller";
Expand All @@ -24,6 +25,7 @@ angular.module("app")
.controller("InlineAdderCtrl", inlineAdderController)
.controller("NavbarCtrl", navbarController)
.controller("PaginationCtrl", paginationController)
.controller("PasswordCtrl", passwordController)
.controller("ProgressCtrl", progressController)
.controller("ShowCurrentValueInPopupCtrl", showCurrentValueInPopupController)
.controller("SearchCtrl", searchController)
Expand Down
18 changes: 18 additions & 0 deletions src/ovh-ui-angular/controllers/password.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import zxcvbn from "zxcvbn";

export default class {
constructor () {
this.minLength = 8;
this.maxLength = 30;
}

getPasswordScore (password) {
const result = zxcvbn(password);
this.passwordFeedback = result.feedback.suggestions.join(" ");
this.passwordScore = result.score;
}

checkPasswordLength (password) {
return angular.isString(password) && password.length >= this.minLength && password.length <= this.maxLength;
}
}
4 changes: 4 additions & 0 deletions src/ovh-ui-angular/ovh-ui-angular.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
"controller": "PaginationCtrl",
"group": "components"
},
"password": {
"controller": "PasswordCtrl",
"group": "components"
},
"popover": {
"group": "components"
},
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8872,3 +8872,8 @@ yargs@^12.0.1:
which-module "^2.0.0"
y18n "^3.2.1 || ^4.0.0"
yargs-parser "^10.1.0"

zxcvbn@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/zxcvbn/-/zxcvbn-4.4.2.tgz#28ec17cf09743edcab056ddd8b1b06262cc73c30"
integrity sha1-KOwXzwl0PtyrBW3dixsGJizHPDA=