# -*- coding: utf-8 -*- ############################################################################### # # Cybrosys Technologies Pvt. Ltd. # # Copyright (C) 2023-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 request from odoo.addons.auth_signup.controllers.main import AuthSignupHome class PasswordHint(AuthSignupHome): """A class that handles password hints during user signup and retrieval. Inherits from AuthSignupHome, a class that provides authentication and signup functionality for web users in the Odoo web application framework.""" @http.route('/web/signup', type='http', auth='public', website=True, sitemap=False) def web_auth_signup(self, *args, **kw): """Handle user signup and set the password hint if provided. :param args: Variable-length argument list. :param kw: Keyword arguments. :return: Result of calling the parent method.""" res = super(PasswordHint, self).web_auth_signup() if kw.get('hint'): request.env['res.users'].sudo().search( [('login', '=', kw['login'])]).password_hint = kw.get('hint') return res @http.route('/website/password/hint', type='json', auth='public', website=True) def button_password_hint(self, params): """Retrieve the password hint for a given user login. :param params: JSON object containing user login. :return: JSON response containing the password hint.""" return request.env['res.users'].sudo().search([ ('login', '=', params)]).password_hint