Browse Source

Sep 26 : [FIX] Bug Fixed 'user_login_alert'

pull/282/head
AjmalCybro 2 years ago
parent
commit
a3a4f5f0c8
  1. 2
      user_login_alert/__manifest__.py
  2. 9
      user_login_alert/controllers/main.py
  3. 5
      user_login_alert/doc/RELEASE_NOTES.md

2
user_login_alert/__manifest__.py

@ -22,7 +22,7 @@
'name': 'User Login Alert', 'name': 'User Login Alert',
'summary': """Secure your Odoo account by alerts at right time. If any successful login to your 'summary': """Secure your Odoo account by alerts at right time. If any successful login to your
account happens, an alert mail will be send to you with the browser and IP details.""", account happens, an alert mail will be send to you with the browser and IP details.""",
'version': '16.0.1.0.0', 'version': '16.0.1.0.1',
'description': """Secure your Odoo account by alerts at right time. If any successful login to your 'description': """Secure your Odoo account by alerts at right time. If any successful login to your
account happens, an alert mail will be send to you with the browser and IP details, Odoo 16, Odoo16""", account happens, an alert mail will be send to you with the browser and IP details, Odoo 16, Odoo16""",
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',

9
user_login_alert/controllers/main.py

@ -32,7 +32,6 @@ import odoo.modules.registry
from odoo.tools.translate import _ from odoo.tools.translate import _
from odoo import http from odoo import http
class Home(home.Home): class Home(home.Home):
@http.route('/web/login', type='http', auth="public") @http.route('/web/login', type='http', auth="public")
@ -56,11 +55,9 @@ class Home(home.Home):
request.params['login'], request.params['login'],
request.params['password']) request.params['password'])
if uid is not False: if uid is not False:
user_rec = request.env['res.users'].sudo().search( user_rec = request.env['res.users'].sudo().browse(uid)
[('id', '=', uid)])
if user_rec.partner_id.email and user_rec.has_group( if user_rec.partner_id.email and user_rec.has_group(
'user_login_alert.receive_login_notification'): 'user_login_alert.receive_login_notification'):
send_mail = 0
agent = request.httprequest.environ.get('HTTP_USER_AGENT') agent = request.httprequest.environ.get('HTTP_USER_AGENT')
agent_details = httpagentparser.detect(agent) agent_details = httpagentparser.detect(agent)
user_os = agent_details['os']['name'] user_os = agent_details['os']['name']
@ -105,8 +102,8 @@ class Home(home.Home):
'email_from': request.env.user.company_id.email, 'email_from': request.env.user.company_id.email,
'email_to': email_to 'email_to': email_to
} }
template_id = template_obj.create(template_data) template_id = template_obj.sudo().create(template_data)
template_obj.send(template_id) template_id.send()
request.params['login_success'] = True request.params['login_success'] = True
if not redirect: if not redirect:
redirect = '/web' redirect = '/web'

5
user_login_alert/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
#### ADD #### ADD
Migration Of User Login Alert Migration Of User Login Alert
#### 26.09.2023
#### Version 16.0.1.0.1
#### BUGFIX
- Bug Fix: Fixed an issue with the email sending function. Access issue resolved

Loading…
Cancel
Save