diff --git a/login_using_qr/README.rst b/login_using_qr/README.rst new file mode 100755 index 000000000..5be932f90 --- /dev/null +++ b/login_using_qr/README.rst @@ -0,0 +1,46 @@ +.. 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 + +QR Code Login +============= +Internal users can login by scanning QR Code. + +Configuration +============= +* External Packages needed:- Open CV(Version 4.2.0), pyzbar + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License v3.0 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +Developer: (V15) Mohamed Muzammil VP, Contact : odoo@cybrosys.com + +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 `__ + +Further information +=================== +HTML Description: ``__ diff --git a/login_using_qr/__init__.py b/login_using_qr/__init__.py new file mode 100644 index 000000000..6136aa492 --- /dev/null +++ b/login_using_qr/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Mohamed Muzammil VP (odoo@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 . +# +############################################################################### +from . import authenticate +from . import controllers +from . import models diff --git a/login_using_qr/__manifest__.py b/login_using_qr/__manifest__.py new file mode 100644 index 000000000..e1d252888 --- /dev/null +++ b/login_using_qr/__manifest__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Mohamed Muzammil VP (odoo@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 . +# +############################################################################### +{ + 'name': 'Login Using QR Code', + 'version': '15.0.1.0.0', + 'category': 'Extra Tools', + 'summary': 'Users can login by scanning QR Code', + 'description': 'A QR code is generate corresponding to each internal user' + ' and,they can use this QR code to login to their account by' + ' scanning it', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'http://www.cybrosys.com', + 'data': [ + 'views/login_templates.xml', + 'views/res_users_views.xml', + 'views/login_using_qr_templates.xml', + ], + 'assets': { + 'web.assets_frontend': [ + 'login_using_qr/static/src/js/login_with_qr.js', + 'login_using_qr/static/src/css/login_with_qr.css', + 'https://cdn.rawgit.com/cozmo/jsQR/master/dist/jsQR.js', + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/login_using_qr/authenticate.py b/login_using_qr/authenticate.py new file mode 100644 index 000000000..324595347 --- /dev/null +++ b/login_using_qr/authenticate.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Mohamed Muzammil VP (odoo@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 . +# +############################################################################### +from odoo.http import OpenERPSession +from odoo.http import request + + +def authenticate_without_passwd(self, db, login=None): + """Authenticate the current user with the details in QR code. + If successful, store the authentication parameters in the + current session and request, unless multi-factor-authentication + is activated. In that case, that last part will be done by + :ref:`finalize`.""" + uid = request.env['res.users'].search([('login', '=', login)]).id + self.pre_uid = uid + self.rotate = True + self.db = db + self.login = login + request.disable_db = False + user = request.env(user=uid)['res.users'].browse(uid) + if not user._mfa_url(): + self.finalize() + return uid +OpenERPSession.authenticate_without_passwd = authenticate_without_passwd diff --git a/login_using_qr/controllers/__init__.py b/login_using_qr/controllers/__init__.py new file mode 100644 index 000000000..dfe299f61 --- /dev/null +++ b/login_using_qr/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Mohamed Muzammil VP (odoo@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 . +# +############################################################################### +from . import login_using_qr diff --git a/login_using_qr/controllers/login_using_qr.py b/login_using_qr/controllers/login_using_qr.py new file mode 100644 index 000000000..f7777dab7 --- /dev/null +++ b/login_using_qr/controllers/login_using_qr.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Mohamed Muzammil VP (odoo@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 . +# +############################################################################### +from odoo import http +from odoo.http import Controller, request + + +class LoginController(Controller): + """Controller that works when Login With QR clicked""" + + @http.route(['/web/redirect'], type='json', auth='none', website=True, + csrf=False, csrf_token=None) + def scanner(self, scanned_qr): + """This code scans the QR provided and Login to the corresponding user + note: Only Internal User can log in through it""" + users = request.env['res.users'].search([('share', '=', False)]) + login = users.mapped('login') + if scanned_qr in login: + request.session.authenticate_without_passwd( + request.session.db, scanned_qr) + return request.redirect('/') + else: + return False diff --git a/login_using_qr/doc/RELEASE_NOTES.md b/login_using_qr/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..67df5da89 --- /dev/null +++ b/login_using_qr/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 1.02.2024 +#### Version 15.0.1.0.0 +#### ADD +- Initial commit for Login Using QR Code diff --git a/login_using_qr/models/__init__.py b/login_using_qr/models/__init__.py new file mode 100644 index 000000000..1bdad0784 --- /dev/null +++ b/login_using_qr/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Mohamed Muzammil VP (odoo@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 . +# +############################################################################### +from . import res_users diff --git a/login_using_qr/models/res_users.py b/login_using_qr/models/res_users.py new file mode 100644 index 000000000..7d0a84796 --- /dev/null +++ b/login_using_qr/models/res_users.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Mohamed Muzammil VP (odoo@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 . +# +############################################################################### +try: + import qrcode +except ImportError: + qrcode = None +try: + import base64 +except ImportError: + base64 = None +from io import BytesIO +from odoo import fields, models, _ +from odoo.exceptions import UserError + + +class ResUsers(models.Model): + """ Inherit the model to add a field and methods""" + _inherit = "res.users" + + qr_code = fields.Binary(string='QRcode', compute="_compute_qr_code", + help="Use this to login (only for internal users)") + + def _compute_qr_code(self): + """Method to generate QR code""" + for detail in self: + if qrcode and base64: + qr_code = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=3, + border=4,) + qr_code.add_data(detail.login) + qr_code.make(fit=True) + temp = BytesIO() + qr_code.make_image().save(temp, format="PNG") + detail.update({'qr_code': base64.b64encode(temp.getvalue())}) + else: + raise UserError( + _('Necessary Requirements To Run This Operation Is ' + 'Not Satisfied')) diff --git a/login_using_qr/static/description/assets/icons/check.png b/login_using_qr/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/login_using_qr/static/description/assets/icons/check.png differ diff --git a/login_using_qr/static/description/assets/icons/chevron.png b/login_using_qr/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/login_using_qr/static/description/assets/icons/chevron.png differ diff --git a/login_using_qr/static/description/assets/icons/cogs.png b/login_using_qr/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/login_using_qr/static/description/assets/icons/cogs.png differ diff --git a/login_using_qr/static/description/assets/icons/consultation.png b/login_using_qr/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/login_using_qr/static/description/assets/icons/consultation.png differ diff --git a/login_using_qr/static/description/assets/icons/ecom-black.png b/login_using_qr/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/login_using_qr/static/description/assets/icons/ecom-black.png differ diff --git a/login_using_qr/static/description/assets/icons/education-black.png b/login_using_qr/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/login_using_qr/static/description/assets/icons/education-black.png differ diff --git a/login_using_qr/static/description/assets/icons/hotel-black.png b/login_using_qr/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/login_using_qr/static/description/assets/icons/hotel-black.png differ diff --git a/login_using_qr/static/description/assets/icons/license.png b/login_using_qr/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/login_using_qr/static/description/assets/icons/license.png differ diff --git a/login_using_qr/static/description/assets/icons/lifebuoy.png b/login_using_qr/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/login_using_qr/static/description/assets/icons/lifebuoy.png differ diff --git a/login_using_qr/static/description/assets/icons/manufacturing-black.png b/login_using_qr/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/login_using_qr/static/description/assets/icons/manufacturing-black.png differ diff --git a/login_using_qr/static/description/assets/icons/pos-black.png b/login_using_qr/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/login_using_qr/static/description/assets/icons/pos-black.png differ diff --git a/login_using_qr/static/description/assets/icons/puzzle.png b/login_using_qr/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/login_using_qr/static/description/assets/icons/puzzle.png differ diff --git a/login_using_qr/static/description/assets/icons/restaurant-black.png b/login_using_qr/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/login_using_qr/static/description/assets/icons/restaurant-black.png differ diff --git a/login_using_qr/static/description/assets/icons/service-black.png b/login_using_qr/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/login_using_qr/static/description/assets/icons/service-black.png differ diff --git a/login_using_qr/static/description/assets/icons/trading-black.png b/login_using_qr/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/login_using_qr/static/description/assets/icons/trading-black.png differ diff --git a/login_using_qr/static/description/assets/icons/training.png b/login_using_qr/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/login_using_qr/static/description/assets/icons/training.png differ diff --git a/login_using_qr/static/description/assets/icons/update.png b/login_using_qr/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/login_using_qr/static/description/assets/icons/update.png differ diff --git a/login_using_qr/static/description/assets/icons/user.png b/login_using_qr/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/login_using_qr/static/description/assets/icons/user.png differ diff --git a/login_using_qr/static/description/assets/icons/wrench.png b/login_using_qr/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/login_using_qr/static/description/assets/icons/wrench.png differ diff --git a/login_using_qr/static/description/assets/misc/categories.png b/login_using_qr/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/categories.png differ diff --git a/login_using_qr/static/description/assets/misc/check-box.png b/login_using_qr/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/check-box.png differ diff --git a/login_using_qr/static/description/assets/misc/compass.png b/login_using_qr/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/login_using_qr/static/description/assets/misc/compass.png differ diff --git a/login_using_qr/static/description/assets/misc/corporate.png b/login_using_qr/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/login_using_qr/static/description/assets/misc/corporate.png differ diff --git a/login_using_qr/static/description/assets/misc/customer-support.png b/login_using_qr/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/login_using_qr/static/description/assets/misc/customer-support.png differ diff --git a/login_using_qr/static/description/assets/misc/cybrosys-logo.png b/login_using_qr/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/login_using_qr/static/description/assets/misc/cybrosys-logo.png differ diff --git a/login_using_qr/static/description/assets/misc/features.png b/login_using_qr/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/features.png differ diff --git a/login_using_qr/static/description/assets/misc/logo.png b/login_using_qr/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/login_using_qr/static/description/assets/misc/logo.png differ diff --git a/login_using_qr/static/description/assets/misc/pictures.png b/login_using_qr/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/pictures.png differ diff --git a/login_using_qr/static/description/assets/misc/pie-chart.png b/login_using_qr/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/pie-chart.png differ diff --git a/login_using_qr/static/description/assets/misc/right-arrow.png b/login_using_qr/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/right-arrow.png differ diff --git a/login_using_qr/static/description/assets/misc/star.png b/login_using_qr/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/login_using_qr/static/description/assets/misc/star.png differ diff --git a/login_using_qr/static/description/assets/misc/support.png b/login_using_qr/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/support.png differ diff --git a/login_using_qr/static/description/assets/misc/whatsapp.png b/login_using_qr/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/whatsapp.png differ diff --git a/login_using_qr/static/description/assets/modules/1.png b/login_using_qr/static/description/assets/modules/1.png new file mode 100644 index 000000000..6bc155887 Binary files /dev/null and b/login_using_qr/static/description/assets/modules/1.png differ diff --git a/login_using_qr/static/description/assets/modules/2.png b/login_using_qr/static/description/assets/modules/2.png new file mode 100644 index 000000000..4fbe85ac1 Binary files /dev/null and b/login_using_qr/static/description/assets/modules/2.png differ diff --git a/login_using_qr/static/description/assets/modules/3.png b/login_using_qr/static/description/assets/modules/3.png new file mode 100644 index 000000000..e20126a45 Binary files /dev/null and b/login_using_qr/static/description/assets/modules/3.png differ diff --git a/login_using_qr/static/description/assets/modules/4.png b/login_using_qr/static/description/assets/modules/4.png new file mode 100644 index 000000000..6f654cfdb Binary files /dev/null and b/login_using_qr/static/description/assets/modules/4.png differ diff --git a/login_using_qr/static/description/assets/modules/5.png b/login_using_qr/static/description/assets/modules/5.png new file mode 100644 index 000000000..12bec092a Binary files /dev/null and b/login_using_qr/static/description/assets/modules/5.png differ diff --git a/login_using_qr/static/description/assets/modules/6.png b/login_using_qr/static/description/assets/modules/6.png new file mode 100644 index 000000000..a477d967f Binary files /dev/null and b/login_using_qr/static/description/assets/modules/6.png differ diff --git a/login_using_qr/static/description/assets/screenshots/1.png b/login_using_qr/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..0250624ad Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/1.png differ diff --git a/login_using_qr/static/description/assets/screenshots/5.png b/login_using_qr/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..a66261500 Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/5.png differ diff --git a/login_using_qr/static/description/assets/screenshots/hero.gif b/login_using_qr/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..b0ce20d31 Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/hero.gif differ diff --git a/login_using_qr/static/description/assets/screenshots/qr_login_01.png b/login_using_qr/static/description/assets/screenshots/qr_login_01.png new file mode 100644 index 000000000..dd9d9f8fc Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/qr_login_01.png differ diff --git a/login_using_qr/static/description/assets/screenshots/qr_login_02.png b/login_using_qr/static/description/assets/screenshots/qr_login_02.png new file mode 100644 index 000000000..da8264a3a Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/qr_login_02.png differ diff --git a/login_using_qr/static/description/assets/screenshots/qr_login_03.png b/login_using_qr/static/description/assets/screenshots/qr_login_03.png new file mode 100644 index 000000000..99c424c43 Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/qr_login_03.png differ diff --git a/login_using_qr/static/description/banner.jpg b/login_using_qr/static/description/banner.jpg new file mode 100644 index 000000000..a7ddb2a9d Binary files /dev/null and b/login_using_qr/static/description/banner.jpg differ diff --git a/login_using_qr/static/description/icon.png b/login_using_qr/static/description/icon.png new file mode 100644 index 000000000..16269257f Binary files /dev/null and b/login_using_qr/static/description/icon.png differ diff --git a/login_using_qr/static/description/index.html b/login_using_qr/static/description/index.html new file mode 100644 index 000000000..b1d6e41e9 --- /dev/null +++ b/login_using_qr/static/description/index.html @@ -0,0 +1,403 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

Login Using QR Code

+

Users can Log in by Scanning QR Code

+ + +
+
+
+
+ +
+
+ +
+

Explore This Module

+
+ + + +
+
+ +
+

Overview

+
+
+
This module helps users to log in to their account by scanning their QR Code.
+
+ + +
+
+ +
+

Features

+
+
+
+
+ + Support in Desktop. +
+
+
+
+ + Login by Scanning QR Code +
+
+
+ + +
+
+ +
+

Screenshots

+
+
+
+
+

Print QR Code

+

Go to Settings ->Users & Companies
Inside the Users QR is generated

+ +
+
+

Authenticate by using QR Code

+

Click ->Login With QR
Click the Login With QR, and a camera will be open, scan the QR code there.

+ +
+
+

Opens camera

+ +
+
+

Show the QR code here

+ +
+
+

User Logged in to their account after scanning the QR.

+ +
+
+
+ + +
+
+ +
+

Related Products

+
+
+
+ +
+
+ + +
+
+ +
+

Our Services

+
+
+
+
+
+ +
+
Odoo Customization
+
+
+
+ +
+
Odoo Implementation
+
+
+
+ +
+
Odoo Support
+
+
+
+ +
+
Hire Odoo Developer
+
+
+
+ +
+
Odoo Integration
+
+
+
+ +
+
Odoo Migration
+
+
+
+ +
+
Odoo Consultancy
+
+
+
+ +
+
Odoo Implementation
+
+
+
+ +
+
Odoo Licensing Consultancy
+
+
+
+ + +
+
+ +
+

Our Industries

+
+
+
+
+
+ +
Trading
+

Easily procure and sell your products

+
+
+
+
+ +
POS
+

Easy configuration and convivial experience

+
+
+
+
+ +
Education
+

A platform for educational management

+
+
+
+
+ +
Manufacturing
+

Plan, track and schedule your operations

+
+
+
+
+ +
E-commerce & Website
+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +
Service Management
+

Keep track of services and invoice

+
+
+
+
+ +
Restaurant
+

Run your bar or restaurant methodically

+
+
+
+
+ +
Hotel Management
+

An all-inclusive hotel management application

+
+
+
+
+ + +
+
+ +
+

Support

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 27707

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/login_using_qr/static/src/css/login_with_qr.css b/login_using_qr/static/src/css/login_with_qr.css new file mode 100644 index 000000000..a5a096fc1 --- /dev/null +++ b/login_using_qr/static/src/css/login_with_qr.css @@ -0,0 +1,34 @@ +.clearfix.oe_login_buttons.text-center.mb-1.pt-3{ + position:relative; +} + +.qr_video { + position: absolute; + top: -353px; + left: -269px; +} + +.video-container{ +width:717px; +} + +.video-container video{ +width:100% !important; +height:100% !important; +} + +.o_database_list .input-group-prepend .btn, .input-group-append a{ + z-index:0 !important; +} + +@media (max-width: 767.98px) { +.qr_video{ + position: absolute; + top: -281px; + min-width: 200px; + left: -63px; +} +.video-container { +width:360px; + +}} \ No newline at end of file diff --git a/login_using_qr/static/src/js/login_with_qr.js b/login_using_qr/static/src/js/login_with_qr.js new file mode 100644 index 000000000..a9824078d --- /dev/null +++ b/login_using_qr/static/src/js/login_with_qr.js @@ -0,0 +1,68 @@ +odoo.define('login_using_qr.qr_login', function (require) { + 'use strict'; + var publicWidget = require('web.public.widget'); + var ajax = require('web.ajax'); +// var Dialog = require('web.Dialog'); + var rpc = require('web.rpc') + var core = require('web.core'); +// var session = require('web.session'); + + var _t = core._t; + publicWidget.registry.QrLogin = publicWidget.Widget.extend({ + selector: '.oe_qr_login', + events: { + 'click #login_click': '_onLoginClick', + 'click #close_qr_scanner':'_onClickClose' + }, + + _onClickClose: function(ev) { + window.location.reload(); + }, + + _onLoginClick: function(ev) { + $(ev.target.offsetParent.querySelector('.qr_video')).removeClass('d-none'); + $(ev.target.offsetParent.querySelector('.close_button')).removeClass('d-none'); + const video = ev.target.offsetParent.querySelector('#video'); + var cam_stream + navigator.mediaDevices.getUserMedia({ video: true }) + .then((stream) => { + cam_stream = stream + video.srcObject = stream; + }) + .catch((error) => { + }); + video.addEventListener('loadedmetadata', (event) => { + // Adjust video size once metadata is loaded + video.width = video.videoWidth; + video.height = video.videoHeight; + }); + video.addEventListener('canplay', () => { + const canvas = document.createElement('canvas'); + const context = canvas.getContext('2d'); + canvas.width = video.width; + canvas.height = video.height; + setInterval(() => { + context.drawImage(video, 0, 0, canvas.width, canvas.height); + const imageData = context.getImageData(0, 0, canvas.width, canvas.height); + const code = jsQR(imageData.data, imageData.width, imageData.height); + if (code) { + ajax.jsonRpc('/web/redirect', 'call', {'scanned_qr': code.data} + ).then((token) => { + if(token){ + cam_stream.getTracks().forEach(function(track) { + track.stop(); + window.location.href = '/'; + }); + } + else{ + alert('Scanned QR does not exist. Please try again.'); + window.location.reload(); + } + }); + } + }, 1000); // Adjust the interval as needed + }); + } + + }) +}); diff --git a/login_using_qr/views/login_templates.xml b/login_using_qr/views/login_templates.xml new file mode 100644 index 000000000..466d2b850 --- /dev/null +++ b/login_using_qr/views/login_templates.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/login_using_qr/views/login_using_qr_templates.xml b/login_using_qr/views/login_using_qr_templates.xml new file mode 100644 index 000000000..a09258df6 --- /dev/null +++ b/login_using_qr/views/login_using_qr_templates.xml @@ -0,0 +1,33 @@ + + + + + + + diff --git a/login_using_qr/views/res_users_views.xml b/login_using_qr/views/res_users_views.xml new file mode 100644 index 000000000..deb546c6e --- /dev/null +++ b/login_using_qr/views/res_users_views.xml @@ -0,0 +1,17 @@ + + + + + res.users.view.form.inherit.login.using.qr + res.users + + + + + LOGIN QR
+ +
+
+
+
+