@ -0,0 +1,44 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
User Password Strength - Restrict Weak Password |
|||
============================================== |
|||
This module helps you to restrict weak password in user signup form. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
* Developers: (V17) Farha V C |
|||
(V18) Ashwin T |
|||
|
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
|||
|
|||
|
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ashwin T (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import controllers |
|||
from . import models |
@ -0,0 +1,47 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ashwin T (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
########################################################################### |
|||
{ |
|||
'name': "User Password Strength - Restrict Weak Password", |
|||
'version': "18.0.1.0.0", |
|||
'summary': """ User password strength - restrict weak password""", |
|||
'description': """ Customized setting to restrict weak password which is |
|||
completely configurable. Also, allows the preset password strength checkup |
|||
while resetting.""", |
|||
'author': "Cybrosys Techno Solutions", |
|||
'company': "Cybrosys Techno Solutions", |
|||
'maintainer': "Cybrosys Techno Solutions", |
|||
'website': "https://cybrosys.com/", |
|||
'category': 'Tools', |
|||
'depends': ['base', 'website'], |
|||
'data': [ |
|||
'views/signup_page_view.xml', |
|||
'views/restrict_password.xml', |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'assets': { |
|||
'web.assets_frontend': ['user_password_strength/static/src/js/signup_user.js', ], |
|||
}, |
|||
'license': "AGPL-3", |
|||
'installable': True, |
|||
'auto_install': True, |
|||
'application': False |
|||
} |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ashwin T (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import main |
@ -0,0 +1,86 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ashwin T (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import http, _ |
|||
from odoo.addons.web.controllers.home import Home, LOGIN_SUCCESSFUL_PARAMS |
|||
from odoo.exceptions import UserError |
|||
from odoo.http import request |
|||
import re |
|||
LOGIN_SUCCESSFUL_PARAMS.add('account_created') |
|||
|
|||
|
|||
class PasswordSecurity(Home): |
|||
"""overriding the website signup controller""" |
|||
def _prepare_signup_values(self, qcontext): |
|||
"""getting the values from config settings""" |
|||
values = {key: qcontext.get(key) for key in ('login', 'name', |
|||
'password')} |
|||
get_param = request.env['ir.config_parameter'].sudo().get_param |
|||
config_strength = get_param('user_password_strength.is_strength') |
|||
config_digit = get_param('user_password_strength.is_digit') |
|||
config_upper = get_param('user_password_strength.is_upper') |
|||
config_lower = get_param('user_password_strength.is_lower') |
|||
config_special_symbol = get_param('user_password_strength' |
|||
'.is_special_symbol') |
|||
|
|||
if not values: |
|||
raise UserError(_("The form was not properly filled in.")) |
|||
if values.get('password') != qcontext.get('confirm_password'): |
|||
raise UserError(_("Passwords do not match; please retype them.")) |
|||
if values.get('password'): |
|||
current_password = str(values.get('password')) |
|||
if config_strength and (len(current_password) < 8): |
|||
raise UserError(_("*****The Password Should have 8 characters." |
|||
"")) |
|||
else: |
|||
if config_digit and (re.search('[0-9]', current_password) |
|||
is None): |
|||
raise UserError(_( |
|||
"*****The Password Should have at least one number.")) |
|||
if config_upper and (re.search('[A-Z]', current_password) |
|||
is None): |
|||
raise UserError(_( |
|||
"*****The Password Should have at least " |
|||
"one uppercase character.")) |
|||
if config_lower and (re.search("[a-z]", current_password) |
|||
is None): |
|||
raise UserError(_( |
|||
"*****The Password Should have at least one " |
|||
"lowercase character.")) |
|||
if config_special_symbol and \ |
|||
(re.search("[~!@#$%^&*]", current_password) is None): |
|||
raise UserError(_( |
|||
"*****The Password Should have at least " |
|||
"one special symbol.")) |
|||
return super()._prepare_signup_values(qcontext) |
|||
|
|||
@http.route('/web/config_params', type='json', auth="public") |
|||
def website_get_config_value(self): |
|||
"""returning the values from config settings to js""" |
|||
get_param = request.env['ir.config_parameter'].sudo().get_param |
|||
return { |
|||
'config_strength': get_param('user_password_strength.is_strength'), |
|||
'config_digit': get_param('user_password_strength.is_digit'), |
|||
'config_upper': get_param('user_password_strength.is_upper'), |
|||
'config_lower': get_param('user_password_strength.is_lower'), |
|||
'config_special_symbol': get_param('user_password_strength' |
|||
'.is_special_symbol') |
|||
} |
@ -0,0 +1,7 @@ |
|||
## Module <user_password_strength-restrict_weak_password> |
|||
|
|||
#### 16.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
|
|||
- Initial Commit for User Password Strength - Restrict Weak Password |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ashwin T (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import restrict_password |
|||
from . import change_password_user |
@ -0,0 +1,83 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ashwin T (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import models, _ |
|||
import re |
|||
from odoo.exceptions import UserError |
|||
from odoo.http import request |
|||
|
|||
|
|||
class ChangePasswordUser(models.TransientModel): |
|||
""" Inherited model to configure users in the change password wizard. """ |
|||
_inherit = 'change.password.user' |
|||
|
|||
def change_password_button(self): |
|||
"""Overriding the password reset function""" |
|||
for line in self: |
|||
get_param = request.env['ir.config_parameter'].sudo().get_param |
|||
config_strength = get_param( |
|||
'user_password_strength.is_strength') |
|||
config_digit = get_param('user_password_strength.is_digit') |
|||
config_upper = get_param('user_password_strength.is_upper') |
|||
config_lower = get_param('user_password_strength.is_lower') |
|||
config_special_symbol = get_param('user_password_strength' |
|||
'.is_special_symbol') |
|||
if line.new_passwd: |
|||
current_password = line.new_passwd |
|||
if config_strength and (len(current_password) < 8): |
|||
raise UserError( |
|||
_("*****The Password Should have 8 characters." |
|||
"")) |
|||
else: |
|||
if config_digit and ( |
|||
re.search('[0-9]', current_password) |
|||
is None): |
|||
raise UserError(_( |
|||
"*****The Password Should have at least one " |
|||
"number.")) |
|||
if config_upper and ( |
|||
re.search('[A-Z]', current_password) |
|||
is None): |
|||
raise UserError(_( |
|||
"*****The Password Should have at least " |
|||
"one uppercase character.")) |
|||
if config_lower and ( |
|||
re.search("[a-z]", current_password) |
|||
is None): |
|||
raise UserError(_( |
|||
"*****The Password Should have at least one " |
|||
"lowercase character.")) |
|||
if config_special_symbol and \ |
|||
(re.search("[~!@#$%^&*]", |
|||
current_password) is None): |
|||
raise UserError(_( |
|||
"*****The Password Should have at least " |
|||
"one special symbol.")) |
|||
line.user_id._change_password(line.new_passwd) |
|||
else: |
|||
if (not config_strength and not |
|||
config_digit and not config_upper and not |
|||
config_lower and not config_special_symbol): |
|||
# don't keep temporary passwords in the database longer |
|||
# than necessary |
|||
self.write({'new_passwd': False}) |
|||
else: |
|||
raise UserError(_("The password cannot be empty.")) |
@ -0,0 +1,54 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ashwin T (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import models, fields |
|||
|
|||
|
|||
class ConfSettings(models.TransientModel): |
|||
"""inheriting configuration settings.""" |
|||
_inherit = "res.config.settings" |
|||
|
|||
user_password_restrict = fields.Boolean(string="Restrict User Password", |
|||
help="Tick this to enable password" |
|||
"restriction", default=True) |
|||
is_strength = fields.Boolean(string="Should have 8 characters", |
|||
help="Enable this to check for 8 characters", |
|||
config_parameter='user_password_strength.' |
|||
'is_strength') |
|||
is_digit = fields.Boolean(string="Should have at least one number", |
|||
help="Enable this to check for at least a digit", |
|||
config_parameter='user_password_strength.' |
|||
'is_digit') |
|||
is_upper = fields.Boolean(string="Should have at least one uppercase", |
|||
help="Enable this to check for uppercase letter", |
|||
config_parameter='user_password_strength.' |
|||
'is_upper') |
|||
is_lower = fields.Boolean(string="Should have at least one " |
|||
"lowercase character", |
|||
help="Enable this to check for lowercase letter", |
|||
config_parameter='user_password_strength.' |
|||
'is_lower') |
|||
is_special_symbol = fields.Boolean(string="Should have at least one " |
|||
"special symbol", |
|||
help="Enable this to check for " |
|||
"special symbol", |
|||
config_parameter='user_password_strength' |
|||
'.is_special_symbol') |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 219 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 9.9 KiB |
@ -0,0 +1,146 @@ |
|||
/** @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 { rpc } from "@web/core/network/rpc"; |
|||
import publicWidget from "@web/legacy/js/public/public_widget"; |
|||
var password = document.getElementById("password"); |
|||
publicWidget.registry.SignUpFormKeyupChange = 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) { |
|||
var passwordInput = ev.currentTarget; // Get the password input field
|
|||
var current_pwd = passwordInput.value; // Get the current password value
|
|||
if (current_pwd.length === 0) { |
|||
var progressBar = document.getElementById("progress"); |
|||
if (progressBar) { |
|||
progressBar.value = "0"; |
|||
progressBar.style.backgroundColor = "#FF0000"; // Reset to red
|
|||
} |
|||
return; |
|||
} |
|||
|
|||
rpc('/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){ |
|||
switch (prog) { |
|||
case 0: |
|||
case 1: |
|||
progress = "20"; |
|||
currentColor = colors[0]; |
|||
break; |
|||
case 2: |
|||
progress = "25"; |
|||
currentColor = colors[0]; |
|||
break; |
|||
case 3: |
|||
progress = "100"; |
|||
currentColor = colors[1]; |
|||
break; |
|||
case 4: |
|||
progress = "75"; |
|||
currentColor = colors[1]; |
|||
break; |
|||
case 5: |
|||
progress = "100"; |
|||
currentColor = colors[1]; |
|||
break; |
|||
} |
|||
} |
|||
//When 4 conditions are enabled in config settings
|
|||
if (flag == 4){ |
|||
switch (prog) { |
|||
case 0: |
|||
case 1: |
|||
case 2: |
|||
progress = "25"; |
|||
currentColor = colors[0]; |
|||
break; |
|||
case 3: |
|||
progress = "50"; |
|||
currentColor = colors[0]; |
|||
break; |
|||
case 4: |
|||
progress = "75"; |
|||
currentColor = colors[1]; |
|||
break; |
|||
case 5: |
|||
progress = "100"; |
|||
currentColor = colors[1]; |
|||
break; |
|||
} |
|||
} |
|||
//When 3 conditions are enabled in config settings
|
|||
if (flag == 3){ |
|||
switch (prog) { |
|||
case 0: |
|||
case 1: |
|||
case 2: |
|||
case 3: |
|||
progress = "33.33"; |
|||
currentColor = colors[0]; |
|||
break; |
|||
case 4: |
|||
progress = "66.66"; |
|||
currentColor = colors[1]; |
|||
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]; |
|||
} |
|||
} |
|||
//When only 1 condition is enabled in config settings
|
|||
if (flag == 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; |
|||
} |
|||
}); |
|||
var current_pwd = password.value |
|||
if (current_pwd.length === 0) { |
|||
document.getElementById("progress").value = "0"; |
|||
return; |
|||
} |
|||
}, |
|||
}); |
@ -0,0 +1,52 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Inherit and Extend Base Settings Form View --> |
|||
<record id="res_config_settings_inherit_view_form" model="ir.ui.view"> |
|||
<field name="name">res.config.settings.inherit.view</field> |
|||
<field name="model">res.config.settings</field> |
|||
<field name="inherit_id" ref="base.res_config_settings_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<!-- Insert our new settings after the existing password reset section --> |
|||
<xpath expr="//setting[@id='enable_password_reset']" position="after"> |
|||
<div class="col-12 col-lg-6 o_setting_box" |
|||
id="enable_password_restrict"> |
|||
<div class="o_setting_left_pane"> |
|||
<field name="user_password_restrict"/> |
|||
</div> |
|||
<div class="o_setting_right_pane"> |
|||
<label string="Restrict User Password" |
|||
for="user_password_restrict"/> |
|||
<div class="text-muted"> |
|||
Enable user password strength - |
|||
restricting weak password |
|||
</div> |
|||
<div class="mt16" invisible="user_password_restrict==False"> |
|||
<div class="content-group" id="restrict"> |
|||
<div> |
|||
<field name="is_strength"/> |
|||
<label for="is_strength"/> |
|||
</div> |
|||
<div> |
|||
<field name="is_digit"/> |
|||
<label for="is_digit"/> |
|||
</div> |
|||
<div> |
|||
<field name="is_upper"/> |
|||
<label for="is_upper"/> |
|||
</div> |
|||
<div> |
|||
<field name="is_lower"/> |
|||
<label for="is_lower"/> |
|||
</div> |
|||
<div> |
|||
<field name="is_special_symbol"/> |
|||
<label for="is_special_symbol"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<template id="document_fields" inherit_id="auth_signup.fields"> |
|||
<!-- Inherit and Extend the Standard Auth Signup Fields Template --> |
|||
<xpath expr="//input[@name='password']" position="after"> |
|||
<div> |
|||
<br> |
|||
</br> |
|||
<progress id="progress" value="0" max="100" |
|||
style="color: red;">70</progress> |
|||
</div> |
|||
</xpath> |
|||
</template> |
|||
</odoo> |