diff --git a/user_password_strength/__manifest__.py b/user_password_strength/__manifest__.py
index 364c17023..11bb56f21 100644
--- a/user_password_strength/__manifest__.py
+++ b/user_password_strength/__manifest__.py
@@ -20,7 +20,7 @@
#
###########################################################################
{
- 'name': "User Password Strength",
+ 'name': "User Password Strength - Restrict Weak Password",
'version': "17.0.1.0.0",
'summary': """ User password strength - restrict weak password""",
'description': """ Customized setting to restrict weak password which is
@@ -38,7 +38,10 @@
],
'images': ['static/description/banner.jpg'],
'assets': {
- 'web.assets_frontend': ['user_password_strength/static/src/js/signup_user.js', ],
+ 'web.assets_frontend': [
+ 'user_password_strength/static/src/js/signup_user.js',
+ 'user_password_strength/static/src/js/reset_user.js',
+ ],
},
'license': "AGPL-3",
'installable': True,
diff --git a/user_password_strength/static/description/assets/modules/module01.png b/user_password_strength/static/description/assets/modules/module01.png
new file mode 100644
index 000000000..a9936f593
Binary files /dev/null and b/user_password_strength/static/description/assets/modules/module01.png differ
diff --git a/user_password_strength/static/description/assets/modules/module02.png b/user_password_strength/static/description/assets/modules/module02.png
new file mode 100644
index 000000000..1a9e2cbd7
Binary files /dev/null and b/user_password_strength/static/description/assets/modules/module02.png differ
diff --git a/user_password_strength/static/description/assets/modules/module03.png b/user_password_strength/static/description/assets/modules/module03.png
new file mode 100644
index 000000000..d3d28e08b
Binary files /dev/null and b/user_password_strength/static/description/assets/modules/module03.png differ
diff --git a/user_password_strength/static/description/assets/modules/module04.png b/user_password_strength/static/description/assets/modules/module04.png
new file mode 100644
index 000000000..5297b364a
Binary files /dev/null and b/user_password_strength/static/description/assets/modules/module04.png differ
diff --git a/user_password_strength/static/description/assets/modules/module05.png b/user_password_strength/static/description/assets/modules/module05.png
new file mode 100644
index 000000000..2263f673e
Binary files /dev/null and b/user_password_strength/static/description/assets/modules/module05.png differ
diff --git a/user_password_strength/static/description/assets/modules/module06.png b/user_password_strength/static/description/assets/modules/module06.png
new file mode 100644
index 000000000..0b8c68699
Binary files /dev/null and b/user_password_strength/static/description/assets/modules/module06.png differ
diff --git a/user_password_strength/static/description/assets/screenshots/PSCO5.png b/user_password_strength/static/description/assets/screenshots/PSCO5.png
new file mode 100644
index 000000000..87f2ce104
Binary files /dev/null and b/user_password_strength/static/description/assets/screenshots/PSCO5.png differ
diff --git a/user_password_strength/static/description/assets/screenshots/hero.gif b/user_password_strength/static/description/assets/screenshots/hero.gif
index a4a76ccd5..527f0afe2 100644
Binary files a/user_password_strength/static/description/assets/screenshots/hero.gif and b/user_password_strength/static/description/assets/screenshots/hero.gif differ
diff --git a/user_password_strength/static/description/index.html b/user_password_strength/static/description/index.html
index a49b5316a..33a9bbdc0 100644
--- a/user_password_strength/static/description/index.html
+++ b/user_password_strength/static/description/index.html
@@ -4,7 +4,7 @@
- Odoo App 3 Index
+ User password strength - restrict weak password
- User Password Strength - Restrict Weak Password
+ USER PASSWORD STRENGTH - RESTRICT WEAK PASSWORD
User Password Strength - Configurable setting to restrict
@@ -226,7 +226,32 @@
If selected conditions of the password is not satisfies the user password an error message will appear as warning about the conditions in signup form and restricting further signup.
-
+
+
+
+
+
+ Create a New Password
+
+
+
+
+
+
+ Users can create a new password by ensuring it is strong, using a mix of uppercase and lowercase letters, numbers, and special characters.
+
+
+
+
+
+
@@ -245,6 +270,7 @@
+
diff --git a/user_password_strength/static/src/js/reset_user.js b/user_password_strength/static/src/js/reset_user.js
new file mode 100644
index 000000000..1715fda41
--- /dev/null
+++ b/user_password_strength/static/src/js/reset_user.js
@@ -0,0 +1,133 @@
+/** @odoo-module **/
+ /*Extending the public widget of the signup form for checking the user
+ password strength conditions on input password function of the password field in
+ the sign up form,Based on the conditions from configuration settings*/
+import { jsonrpc } from "@web/core/network/rpc_service";
+import publicWidget from "@web/legacy/js/public/public_widget";
+
+publicWidget.registry.ResetFormInputPasswordChange = publicWidget.Widget.extend({
+ selector: '.oe_website_login_container',
+ events: {
+ 'input input[type="password"]': '_onPasswordInput', // Using input event instead of keypress
+ },
+ start() {
+ this._super.apply(this, arguments);
+ },
+
+ _onPasswordInput: function (ev) {
+ // Get the password field value
+ var password = ev.currentTarget.value;
+
+ // Reset the progress bar if the password field is empty
+ var progressBar = document.getElementById("progress");
+ if (password.length === 0) {
+ if (progressBar) {
+ progressBar.value = "0";
+ progressBar.style.backgroundColor = "#FF0000"; // Reset to red
+ }
+ return;
+ }
+
+ // Fetch configuration settings via jsonrpc
+ jsonrpc('/web/config_params', {}).then(function (data) {
+ var conditions = [];
+ for (let key in data) {
+ conditions.push(data[key]);
+ }
+
+ var flag = conditions.filter(cond => cond === 'True').length;
+
+ // Evaluate password strength based on specific conditions
+ var prog = [/[$@$!%*#?&]/, /[A-Z]/, /[0-9]/, /[a-z]/]
+ .reduce((memo, test) => memo + test.test(password), 0);
+
+ if (prog > 2 && password.length > 7) {
+ prog++;
+ }
+
+ var progress = "0";
+ var colors = ['#FF0000', '#00FF00', '#0000FF']; // Red, Green, Blue for progress levels
+ var currentColor = colors[0];
+
+ // Adjust progress based on conditions enabled
+ switch (flag) {
+ case 5:
+ switch (prog) {
+ case 0:
+ case 1:
+ progress = "20";
+ break;
+ case 2:
+ progress = "25";
+ break;
+ case 3:
+ progress = "50";
+ currentColor = colors[1]; // Green
+ break;
+ case 4:
+ progress = "75";
+ currentColor = colors[1]; // Green
+ break;
+ case 5:
+ progress = "100";
+ currentColor = colors[1]; // Green
+ break;
+ }
+ break;
+ case 4:
+ switch (prog) {
+ case 0:
+ case 1:
+ case 2:
+ progress = "25";
+ break;
+ case 3:
+ progress = "50";
+ currentColor = colors[0]; // Red
+ break;
+ case 4:
+ progress = "75";
+ currentColor = colors[1]; // Green
+ break;
+ case 5:
+ progress = "100";
+ currentColor = colors[1]; // Green
+ break;
+ }
+ break;
+ case 3:
+ switch (prog) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ progress = "33.33";
+ break;
+ case 4:
+ progress = "66.66";
+ currentColor = colors[1]; // Green
+ break;
+ case 5:
+ progress = "100";
+ currentColor = colors[1]; // Green
+ break;
+ }
+ break;
+ case 2:
+ progress = (prog !== 5) ? "50" : "100";
+ currentColor = (prog !== 5) ? colors[0] : colors[1]; // Red or Green
+ break;
+ case 1:
+ progress = "100";
+ currentColor = colors[1]; // Green
+ break;
+ }
+
+ // Update progress bar
+ if (progressBar) {
+ progressBar.value = progress;
+ progressBar.style.backgroundColor = currentColor;
+ }
+ });
+ },
+});
diff --git a/user_password_strength/static/src/js/signup_user.js b/user_password_strength/static/src/js/signup_user.js
index 101394d30..4f6f0d268 100644
--- a/user_password_strength/static/src/js/signup_user.js
+++ b/user_password_strength/static/src/js/signup_user.js
@@ -1,135 +1,135 @@
/** @odoo-module **/
- /*Extending the public widget of the signup form for checking the user
- password strength conditions on key up function of the password field in
- the sign up form,Based on the conditions from configuration settings.*/
- import { jsonrpc } from "@web/core/network/rpc_service";
- import publicWidget from "@web/legacy/js/public/public_widget";
- var password = document.getElementById("password");
- publicWidget.registry.SignUpFormKeyupChange = publicWidget.Widget.extend({
+ /*Extending the public widget of the reset form for checking the user
+ password strength conditions on password input function of the password field in
+ the reset form,Based on the conditions from configuration settings.*/
+import { jsonrpc } from "@web/core/network/rpc_service";
+import publicWidget from "@web/legacy/js/public/public_widget";
+
+publicWidget.registry.SignUpFormInputPasswordChange = publicWidget.Widget.extend({
selector: '.oe_signup_form',
events: {
- 'keypress input': '_onKeypress',
+ 'input input[type="password"]': '_onPasswordInput', // Listening for input event on password field
},
- init() {
- this._super(...arguments);
- },
- _onKeypress: function () {
- jsonrpc('/web/config_params',{}).then(function (data) {
- var list=[]
- for (let x in data) {
- list.push(data[x]);
- }
- var flag = 0
- for(var i=0;i<=list.length;i++){
- if(list[i] == 'True'){
- flag +=1
- }
- }
- var prog = [/[$@$!%*#?&]/, /[A-Z]/, /[0-9]/, /[a-z]/]
- .reduce((memo, test) => memo + test.test(current_pwd),
- 0);
- if(prog > 2 && current_pwd.length > 7){
- prog++;
- }
- var progress = "";
- var colors = ['#FF0000', '#00FF00','#0000FF'];
- var currentColor = 0;
- //When 5 conditions are enabled in config settings
- if (flag == 5){
+
+ start() {
+ this._super.apply(this, arguments);
+ },
+
+ _onPasswordInput: function (ev) {
+ var passwordInput = ev.currentTarget; // Get the password input field
+ var current_pwd = passwordInput.value; // Get the current password value
+
+ // Reset the progress bar if the password field is empty
+ if (current_pwd.length === 0) {
+ var progressBar = document.getElementById("progress");
+ if (progressBar) {
+ progressBar.value = "0";
+ progressBar.style.backgroundColor = "#FF0000"; // Reset to red
+ }
+ return;
+ }
+
+ // Fetch configuration settings via jsonrpc
+ jsonrpc('/web/config_params', {}).then(function (data) {
+ var conditions = [];
+ for (let key in data) {
+ conditions.push(data[key]);
+ }
+
+ var flag = conditions.filter(cond => cond === 'True').length;
+
+ // Evaluate password strength based on specific conditions
+ var prog = [/[$@$!%*#?&]/, /[A-Z]/, /[0-9]/, /[a-z]/]
+ .reduce((memo, test) => memo + test.test(current_pwd), 0);
+
+ if (prog > 2 && current_pwd.length > 7) {
+ prog++;
+ }
+
+ var progress = "0";
+ var colors = ['#FF0000', '#00FF00', '#0000FF']; // Red, Green, Blue for progress levels
+ var currentColor = colors[0];
+
+ // Adjust progress based on conditions enabled
+ switch (flag) {
+ case 5:
switch (prog) {
case 0:
case 1:
- progress = "20";
- currentColor = colors[0];
- break;
+ progress = "20";
+ break;
case 2:
- progress = "25";
- currentColor = colors[0];
- break;
+ progress = "25";
+ break;
case 3:
- progress = "100";
- currentColor = colors[1];
- break;
+ progress = "50";
+ currentColor = colors[1]; // Green
+ break;
case 4:
- progress = "75";
- currentColor = colors[1];
- break;
+ progress = "75";
+ currentColor = colors[1]; // Green
+ break;
case 5:
- progress = "100";
- currentColor = colors[1];
- break;
+ progress = "100";
+ currentColor = colors[1]; // Green
+ break;
}
- }
- //When 4 conditions are enabled in config settings
- if (flag == 4){
+ break;
+ case 4:
switch (prog) {
case 0:
case 1:
case 2:
- progress = "25";
- currentColor = colors[0];
- break;
+ progress = "25";
+ break;
case 3:
- progress = "50";
- currentColor = colors[0];
- break;
+ progress = "50";
+ currentColor = colors[0]; // Red
+ break;
case 4:
- progress = "75";
- currentColor = colors[1];
- break;
+ progress = "75";
+ currentColor = colors[1]; // Green
+ break;
case 5:
- progress = "100";
- currentColor = colors[1];
- break;
+ progress = "100";
+ currentColor = colors[1]; // Green
+ break;
}
- }
- //When 3 conditions are enabled in config settings
- if (flag == 3){
+ break;
+ case 3:
switch (prog) {
case 0:
case 1:
case 2:
case 3:
- progress = "33.33";
- currentColor = colors[0];
- break;
+ progress = "33.33";
+ break;
case 4:
- progress = "66.66";
- currentColor = colors[1];
- break;
+ progress = "66.66";
+ currentColor = colors[1]; // Green
+ break;
case 5:
- progress = "100";
- currentColor = colors[1];
- break;
- }
- }
- //When 2 conditions are enabled in config settings
- if (flag == 2) {
- if (prog != 5) {
- progress = "50";
- currentColor = colors[0];
- } else{
- progress = "100";
- currentColor = colors[1];
+ progress = "100";
+ currentColor = colors[1]; // Green
+ break;
}
- }
- //When only 1 condition is enabled in config settings
- if (flag == 1){
+ break;
+ case 2:
+ progress = (prog !== 5) ? "50" : "100";
+ currentColor = (prog !== 5) ? colors[0] : colors[1]; // Red or Green
+ break;
+ case 1:
progress = "100";
- currentColor = colors[1];
- }
- var val = document.getElementById("progress")
- if(val!== null){
- document.getElementById("progress").value = progress;
- document.getElementById("progress").style
- .backgroundColor = currentColor;
- }
- });
- // Reset if password length is zero
- var current_pwd = password.value
- if (current_pwd.length === 0) {
- document.getElementById("progress").value = "0";
- return;
- }
- },
+ currentColor = colors[1]; // Green
+ break;
+ }
+
+ // Update progress bar
+ var progressBar = document.getElementById("progress");
+ if (progressBar) {
+ progressBar.value = progress;
+ progressBar.style.backgroundColor = currentColor;
+ }
+ });
+ },
});
diff --git a/user_password_strength/views/restrict_password.xml b/user_password_strength/views/restrict_password.xml
index 4645fb7aa..64326233b 100644
--- a/user_password_strength/views/restrict_password.xml
+++ b/user_password_strength/views/restrict_password.xml
@@ -1,10 +1,12 @@
+
res.config.settings.inherit.viewres.config.settings
+