diff --git a/login_using_qr/README.rst b/login_using_qr/README.rst old mode 100755 new mode 100644 index 1bf96800d..cfd0c13fc --- a/login_using_qr/README.rst +++ b/login_using_qr/README.rst @@ -1,18 +1,32 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html +.. 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 -Login By QR Code -====================== +Login using Qr code +============= Internal users can login by scanning QR Code. +Configuration +============= +* No additional configurations needed + Company ------- * `Cybrosys Techno Solutions `__ +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + + Credits ------- -Developer: (v16) muzammil @ cybrosys +Developer: + (V15) Mohamed Muzammil VP, + (v16) muzammil, + (v17) Anjhana A K, +Contact: odoo@cybrosys.com Contacts -------- diff --git a/login_using_qr/__init__.py b/login_using_qr/__init__.py index 7aed67509..e971ac81b 100644 --- a/login_using_qr/__init__.py +++ b/login_using_qr/__init__.py @@ -3,8 +3,8 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Mohamed Muzammil VP (odoo@cybrosys.com) +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Anjhana A K (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO # GENERAL PUBLIC LICENSE (AGPL v3), Version 3. diff --git a/login_using_qr/__manifest__.py b/login_using_qr/__manifest__.py index 4cc2cfc50..e7b411ddd 100644 --- a/login_using_qr/__manifest__.py +++ b/login_using_qr/__manifest__.py @@ -3,8 +3,8 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Mohamed Muzammil VP (odoo@cybrosys.com) +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Anjhana A K (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO # GENERAL PUBLIC LICENSE (AGPL v3), Version 3. @@ -23,25 +23,28 @@ 'name': 'Login using QR Code', 'version': '16.0.1.0.0', 'category': 'Extra Tools', - 'summary': """Users can login by scanning QR Code""", - 'description': """A QR code is generated inside the users model, - a Internal user can use this QR code to login to their - account by scanning it""", + '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', - 'depends': ['base', 'website'], 'data': [ 'views/login_templates.xml', - 'views/redirect_page_templates.xml', 'views/res_users_views.xml', + 'views/login_using_qr_templates.xml', ], - 'external_dependencies': { - 'python': ['pyzbar', 'cv2'], + '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', + ], }, - 'license': 'AGPL-3', '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 index 4de1e33ef..c61e3bcf5 100644 --- a/login_using_qr/authenticate.py +++ b/login_using_qr/authenticate.py @@ -3,8 +3,8 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Mohamed Muzammil VP (odoo@cybrosys.com) +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Anjhana A K (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO # GENERAL PUBLIC LICENSE (AGPL v3), Version 3. @@ -19,6 +19,7 @@ # If not, see . # ############################################################################### + import odoo from odoo.http import request from odoo.modules.registry import Registry @@ -28,23 +29,18 @@ from odoo.http import Session def authenticate_without_passwd(self, dbname, login): """This function creates a authentication methode without password""" registry = Registry(dbname) - pre_uid = request.env['res.users'].search([('login', '=', login)]).id - + pre_uid = request.env['res.users'].sudo().search([('login', '=', login)]).id self.uid = None self.pre_login = login self.pre_uid = pre_uid - with registry.cursor() as cr: env = odoo.api.Environment(cr, pre_uid, {}) user = env['res.users'].browse(pre_uid) if not user._mfa_url(): self.finalize(env) - if request and request.session is self and request.db == dbname: request.env = odoo.api.Environment(request.env.cr, self.uid, self.context) request.update_context(**self.context) return pre_uid - - Session.authenticate_without_passwd = authenticate_without_passwd diff --git a/login_using_qr/controllers/__init__.py b/login_using_qr/controllers/__init__.py index d9729128f..3f734b9db 100644 --- a/login_using_qr/controllers/__init__.py +++ b/login_using_qr/controllers/__init__.py @@ -3,8 +3,8 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Mohamed Muzammil VP (odoo@cybrosys.com) +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Anjhana A K (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO # GENERAL PUBLIC LICENSE (AGPL v3), Version 3. @@ -19,4 +19,4 @@ # If not, see . # ############################################################################### -from . import qr_scanner +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..c92ff678f --- /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: Anjhana A K (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'].sudo().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/controllers/qr_scanner.py b/login_using_qr/controllers/qr_scanner.py deleted file mode 100644 index 511d29d0c..000000000 --- a/login_using_qr/controllers/qr_scanner.py +++ /dev/null @@ -1,68 +0,0 @@ -import cv2 -from pyzbar.pyzbar import decode -from odoo.http import Controller, request -from odoo import http - -SIGN_UP_REQUEST_PARAMS = {'db', 'login', 'debug', 'token', 'message', 'error', - 'scope', 'mode', - 'redirect', 'redirect_hostname', 'email', 'name', - 'partner_id', - 'password', 'confirm_password', 'city', 'country_id', - 'lang', 'signup_email'} - - -class LoginController(Controller): - """controller that works when Login With QR clicked""" - - @http.route(['/web/redirect'], type='http', auth='none', website=True, - csrf=False, csrf_token=None) - def open_scanner(self, *args, **kw): - """This code scan the QR provided and Login to the corresponding user - note: Only Internal User can login through it""" - try: - cap = cv2.VideoCapture(0) - cap.set(3, 640) - cap.set(4, 480) - - while True: - ret, frame = cap.read() - gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) - for qr_code in decode(gray): - (x, y, w, h) = qr_code.rect - cv2.rectangle(frame, (x, y), (x + w, y + h), - (0, 255, 0), 2) - decoded_text = qr_code.data.decode("utf-8") - users = request.env['res.users'].search( - [('share', '=', False)]) - login = users.mapped('login') - if decoded_text in login: - request.session.authenticate_without_passwd( - request.session.db, decoded_text) - cap.release() - cv2.destroyAllWindows() - return request.redirect('/') - else: - cap.release() - cv2.destroyAllWindows() - # Use the overridden web_login method to show error message - values = {k: v for k, v in request.params.items() if - k in SIGN_UP_REQUEST_PARAMS} - - values['error'] = ("Wrong QR Code") - request.update_env(user=request.session.uid) - request.env["ir.http"]._auth_method_public() - response = request.render('web.login', values) - - return response - - # Display the resulting frame - cv2.imshow('scanner- to exit press "q"', frame) - code = cv2.waitKey(1) - - if code == ord('q'): - cap.release() - cv2.destroyAllWindows() - return request.redirect('/web/login') - except Exception: - return request.render("login_using_qr.be_patient") - diff --git a/login_using_qr/doc/RELEASE_NOTES.md b/login_using_qr/doc/RELEASE_NOTES.md index eac29c18c..9b7a8b40f 100644 --- a/login_using_qr/doc/RELEASE_NOTES.md +++ b/login_using_qr/doc/RELEASE_NOTES.md @@ -1,7 +1,6 @@ ## Module -#### 29.07.2023 -#### Version 16.0.1.0.0 +#### 09.02.2024 +#### Version 17.0.1.0.0 #### ADD - -- Initial commit for Login using QR Code +- Initial commit for Login using Qr code diff --git a/login_using_qr/models/__init__.py b/login_using_qr/models/__init__.py index 270829d88..a1a49056a 100644 --- a/login_using_qr/models/__init__.py +++ b/login_using_qr/models/__init__.py @@ -3,8 +3,8 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Mohamed Muzammil VP (odoo@cybrosys.com) +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Anjhana A K (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO # GENERAL PUBLIC LICENSE (AGPL v3), Version 3. diff --git a/login_using_qr/models/res_users.py b/login_using_qr/models/res_users.py index 8041b6471..8949cda77 100644 --- a/login_using_qr/models/res_users.py +++ b/login_using_qr/models/res_users.py @@ -3,8 +3,8 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Mohamed Muzammil VP (odoo@cybrosys.com) +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Anjhana A K (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO # GENERAL PUBLIC LICENSE (AGPL v3), Version 3. @@ -19,7 +19,6 @@ # If not, see . # ############################################################################### - try: import qrcode except ImportError: @@ -34,28 +33,26 @@ from odoo.exceptions import UserError class ResUsers(models.Model): - """ inherit res.users to add a field in users """ + """ Inherit the model to add a field and methods""" _inherit = "res.users" - qr_code = fields.Binary('QRcode', compute="_compute_generate_qr", + + qr_code = fields.Binary(string='QRcode', compute="_compute_qr_code", help="Use this to login (only for internal users)") - def _compute_generate_qr(self): - """method to generate QR code""" + def _compute_qr_code(self): + """Method to generate QR code""" for detail in self: if qrcode and base64: - qr = qrcode.QRCode( + qr_code = qrcode.QRCode( version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, - box_size=10, - border=1, - ) - qr.add_data(detail.login) - qr.make(fit=True) - img = qr.make_image() + box_size=3, + border=4,) + qr_code.add_data(detail.login) + qr_code.make(fit=True) temp = BytesIO() - img.save(temp, format="PNG",optimise=True) - qr_image = base64.b64encode(temp.getvalue()) - detail.update({'qr_code': qr_image}) + 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 ' diff --git a/login_using_qr/static/description/assets/misc/Cybrosys R.png b/login_using_qr/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/login_using_qr/static/description/assets/misc/Cybrosys R.png differ diff --git a/login_using_qr/static/description/assets/modules/1.jpg b/login_using_qr/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..67c7f7062 Binary files /dev/null and b/login_using_qr/static/description/assets/modules/1.jpg differ diff --git a/login_using_qr/static/description/assets/modules/1.png b/login_using_qr/static/description/assets/modules/1.png deleted file mode 100644 index 618e3e6c4..000000000 Binary files a/login_using_qr/static/description/assets/modules/1.png and /dev/null differ diff --git a/login_using_qr/static/description/assets/modules/2.jpg b/login_using_qr/static/description/assets/modules/2.jpg new file mode 100644 index 000000000..87c2bb2ba Binary files /dev/null and b/login_using_qr/static/description/assets/modules/2.jpg differ diff --git a/login_using_qr/static/description/assets/modules/2.png b/login_using_qr/static/description/assets/modules/2.png deleted file mode 100644 index c1f30354a..000000000 Binary files a/login_using_qr/static/description/assets/modules/2.png and /dev/null differ diff --git a/login_using_qr/static/description/assets/modules/3.png b/login_using_qr/static/description/assets/modules/3.png index 3415917c2..a5299d338 100644 Binary files a/login_using_qr/static/description/assets/modules/3.png 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 index ed11bd818..a0ac2d840 100644 Binary files a/login_using_qr/static/description/assets/modules/4.png and b/login_using_qr/static/description/assets/modules/4.png differ diff --git a/login_using_qr/static/description/assets/modules/5.gif b/login_using_qr/static/description/assets/modules/5.gif deleted file mode 100644 index beb106101..000000000 Binary files a/login_using_qr/static/description/assets/modules/5.gif and /dev/null differ diff --git a/login_using_qr/static/description/assets/modules/5.jpg b/login_using_qr/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..6a102f103 Binary files /dev/null and b/login_using_qr/static/description/assets/modules/5.jpg differ diff --git a/login_using_qr/static/description/assets/modules/6.jpg b/login_using_qr/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..eaf13fef5 Binary files /dev/null and b/login_using_qr/static/description/assets/modules/6.jpg differ diff --git a/login_using_qr/static/description/assets/modules/6.png b/login_using_qr/static/description/assets/modules/6.png deleted file mode 100644 index 1c98e213f..000000000 Binary files a/login_using_qr/static/description/assets/modules/6.png and /dev/null differ diff --git a/login_using_qr/static/description/assets/screenshots/1.png b/login_using_qr/static/description/assets/screenshots/1.png deleted file mode 100644 index 48b933a40..000000000 Binary files a/login_using_qr/static/description/assets/screenshots/1.png and /dev/null differ diff --git a/login_using_qr/static/description/assets/screenshots/2.png b/login_using_qr/static/description/assets/screenshots/2.png deleted file mode 100644 index f166bbf8a..000000000 Binary files a/login_using_qr/static/description/assets/screenshots/2.png and /dev/null differ diff --git a/login_using_qr/static/description/assets/screenshots/3.png b/login_using_qr/static/description/assets/screenshots/3.png deleted file mode 100644 index babbf1ffc..000000000 Binary files a/login_using_qr/static/description/assets/screenshots/3.png and /dev/null differ diff --git a/login_using_qr/static/description/assets/screenshots/4.png b/login_using_qr/static/description/assets/screenshots/4.png deleted file mode 100644 index 7e84d15d7..000000000 Binary files a/login_using_qr/static/description/assets/screenshots/4.png and /dev/null differ diff --git a/login_using_qr/static/description/assets/screenshots/5.png b/login_using_qr/static/description/assets/screenshots/5.png deleted file mode 100644 index cfb605d12..000000000 Binary files a/login_using_qr/static/description/assets/screenshots/5.png and /dev/null differ diff --git a/login_using_qr/static/description/assets/screenshots/hero.gif b/login_using_qr/static/description/assets/screenshots/hero.gif deleted file mode 100644 index f9084cf15..000000000 Binary files a/login_using_qr/static/description/assets/screenshots/hero.gif and /dev/null differ diff --git a/login_using_qr/static/description/assets/screenshots/screenshot1.png b/login_using_qr/static/description/assets/screenshots/screenshot1.png new file mode 100644 index 000000000..2d30b3bde Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/screenshot1.png differ diff --git a/login_using_qr/static/description/assets/screenshots/screenshot2.png b/login_using_qr/static/description/assets/screenshots/screenshot2.png new file mode 100644 index 000000000..2d4a94242 Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/screenshot2.png differ diff --git a/login_using_qr/static/description/assets/screenshots/screenshot3.png b/login_using_qr/static/description/assets/screenshots/screenshot3.png new file mode 100644 index 000000000..5ceede5bf Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/screenshot3.png differ diff --git a/login_using_qr/static/description/assets/screenshots/screenshot4.png b/login_using_qr/static/description/assets/screenshots/screenshot4.png new file mode 100644 index 000000000..9555724f1 Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/screenshot4.png differ diff --git a/login_using_qr/static/description/assets/screenshots/screenshot5.png b/login_using_qr/static/description/assets/screenshots/screenshot5.png new file mode 100644 index 000000000..f24914d4a Binary files /dev/null and b/login_using_qr/static/description/assets/screenshots/screenshot5.png differ diff --git a/login_using_qr/static/description/banner.jpg b/login_using_qr/static/description/banner.jpg index 4c5046cb2..a7ddb2a9d 100644 Binary files a/login_using_qr/static/description/banner.jpg 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 index 736737323..16269257f 100644 Binary files a/login_using_qr/static/description/icon.png 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 index 71a46cc3f..35d2620e8 100644 --- a/login_using_qr/static/description/index.html +++ b/login_using_qr/static/description/index.html @@ -1,581 +1,698 @@ -
- -
- -
-
- Community -
-
- Enterprise -
-
- Odoo.sh -
-
-
- -
-
-
- -

- Login Using QR Code

-

Users can login by scanning QR Code

- - -
-
-
- - -
- - -
-
- -
-

Explore This - Module

-
-
-
- -
- -
- - -
- - -
- -
-
- Configuration - View - configuration for this - module +
+ +
+
+
+
+
+ +
+
+

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

+
+
+
+
+
+
+ + +
+
+

+ Click ->"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.

+
+
+
+
+ +
+
+
    +
  • + Support in Desktop. +
  • +
  • + Login by Scanning QR Code +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:08th Feburary 2024 +
+

+ + Initial Commit for Login using qr code.

+
+
+
+
- -
- -
-
- - - -
-
- -
-

Overview -

-
-
-
- This module helps users to login 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. -
- Inside the Users QR is generated

- -
- -
-

Login using QR Code -

-

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

- -

-
- Scan the QR Code

- -
-
-

Login -

-

User Logged in to their account after scanning the QR

- -
-
-

If QR not accepted

- -
- -
-
- - - -
-
- -
-

Configuration -

-
-
-
-

Install opencv(cv2) and pyzbar packages -

- Version of opencv used here version- 4.2.0, - To install opencv version- 4.2.0 please use the comment - 'sudo apt update' - 'sudo apt install libopencv-dev python3-opencv' -
-
- - - -
-
- -
-

Related - Products -

-
-
-
- - - - - -
-
- -
-

Our Services -

-
- -
-
-
-
- -
-
- Odoo - Customization
-
- -
-
- -
-
- Odoo - Implementation
-
- -
-
- -
-
- Odoo - Support
-
- - -
-
- -
-
- Hire - Odoo - Developer
-
+
+
+

+ Our Services

-
-
- -
-
- 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

-
-
-
-
- - +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire + Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo + Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Licensing Consultancy

+
+
+
+
+
+
+

+ Our Industries

- -
-
- -
-

Support -

-
-
-
-
-
-
- +
-
-

Need Help?

-

Got questions or need help? Get in touch.

- -

- odoo@cybrosys.com

-
+
+
+
+
+ +

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

+
-
-

WhatsApp

-

Say hi to us on WhatsApp!

- -

+91 86068 - 27707

-
+
+
+
+
+
+ +
+ Need + Help? +

Got + questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to + us on WhatsApp!

+
+91 + 99456767686 +
+
+
+
+
+
-
-
-
-
-
-
-
-
- \ No newline at end of file + + + + + + + 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..82a132d69 --- /dev/null +++ b/login_using_qr/static/src/js/login_with_qr.js @@ -0,0 +1,54 @@ +/** @odoo-module **/ + import rpc from 'web.rpc'; + var publicWidget = require('web.public.widget'); + var ajax = require('web.ajax'); + 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(); + }, + + async _onLoginClick(ev) { + ev.target.offsetParent.querySelector('.close_button').classList.remove('d-none'); + const video = ev.target.offsetParent.querySelector('#video'); + var cam_stream = await navigator.mediaDevices.getUserMedia({ video: true}); + video.srcObject = cam_stream; + 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 index 0fd007146..f53d494eb 100644 --- a/login_using_qr/views/login_templates.xml +++ b/login_using_qr/views/login_templates.xml @@ -1,11 +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/redirect_page_templates.xml b/login_using_qr/views/redirect_page_templates.xml deleted file mode 100644 index 6557276cf..000000000 --- a/login_using_qr/views/redirect_page_templates.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - \ No newline at end of file diff --git a/login_using_qr/views/res_users_views.xml b/login_using_qr/views/res_users_views.xml index 87ae71ce4..deb546c6e 100644 --- a/login_using_qr/views/res_users_views.xml +++ b/login_using_qr/views/res_users_views.xml @@ -1,20 +1,17 @@ - - - res.users.view.form.inherit.login.using.qr - res.users - - - + + + res.users.view.form.inherit.login.using.qr + res.users + + LOGIN QR
-
-
-
- + +