diff --git a/access_restriction_by_ip/__manifest__.py b/access_restriction_by_ip/__manifest__.py
index 08c14e97b..07f8f9133 100644
--- a/access_restriction_by_ip/__manifest__.py
+++ b/access_restriction_by_ip/__manifest__.py
@@ -31,8 +31,12 @@
'security/ir.model.access.csv',
'views/allowed_ips_view.xml',
],
+ 'assets': {
+ 'web.assets_backend': [
+ '/access_restriction_by_ip/static/src/js/widget.js',
+ ],
+ },
'images': ['static/description/banner.png'],
'installable': True,
'auto_install': False,
}
-
diff --git a/access_restriction_by_ip/controllers/main.py b/access_restriction_by_ip/controllers/main.py
index e0a79908c..152ee3036 100644
--- a/access_restriction_by_ip/controllers/main.py
+++ b/access_restriction_by_ip/controllers/main.py
@@ -34,10 +34,8 @@ class Home(main.Home):
request.params['login_success'] = False
if request.httprequest.method == 'GET' and redirect and request.session.uid:
return request.redirect(redirect)
-
if not request.uid:
request.uid = odoo.SUPERUSER_ID
-
values = request.params.copy()
try:
values['databases'] = http.db_list()
@@ -85,5 +83,15 @@ class Home(main.Home):
request.uid = old_uid
if e.args == odoo.exceptions.AccessDenied().args:
values['error'] = _("Wrong login/password")
-
return request.render('web.login', values)
+
+ @http.route('/get_ip', auth='user', type='json')
+ def get_ip(self):
+ ip_address = request.httprequest.environ['REMOTE_ADDR']
+ ip_addresses = []
+ for ips in request.env.user.allowed_ips:
+ ip_addresses.append(ips.ip_address)
+ if ip_addresses:
+ if ip_address not in ip_addresses:
+ return False
+ return True
diff --git a/access_restriction_by_ip/models/allowed_ips.py b/access_restriction_by_ip/models/allowed_ips.py
index 105e2a2f3..2d0f0ef18 100644
--- a/access_restriction_by_ip/models/allowed_ips.py
+++ b/access_restriction_by_ip/models/allowed_ips.py
@@ -17,7 +17,7 @@
# If not, see
- User can access his account only from specified IP's + style="font-family: 'Montserrat', sans-serif !important; font-weight: 300 !important; color: #FFFFFF !important; font-size: 1.4rem !important; text-align: center !important;"> + User can access his account only from specified IP's
-+ style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;"> Learn more about this module
+ style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;"> View features of this module
- If no IP is set to user means there is not any restriction by IP. IP Address for each users can be set from users form view
+ style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;"> + If no IP is set to user means there is not any restriction by IP. IP Address for each users can be + set from users form view+ style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;"> Setting IP address for user from users form view
+ style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;"> User will be able to access his account only from this IP's
- On accessing account from a non specified IP. + style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;"> + On accessing account from a non specified IP.(If the user is already logged in he/she will be logged out + after the first reload)
@@ -483,10 +484,10 @@
@@ -498,11 +499,11 @@
@@ -513,11 +514,11 @@
@@ -528,10 +529,10 @@
@@ -543,10 +544,10 @@
@@ -557,11 +558,11 @@
@@ -572,10 +573,10 @@
@@ -597,26 +598,26 @@