@ -0,0 +1,48 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Customize Login Page Style |
|||
========================== |
|||
This module will helps you to customize the login page with different styles. |
|||
|
|||
Configuration |
|||
============= |
|||
- www.odoo.com/documentation/17.0/setup/install.html |
|||
- Install our custom addon |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (LGPL V3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V18) Ayana KP, |
|||
(V17) Mohammed Dilshad Tk, |
|||
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 https://www.cybrosys.com |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import controllers |
|||
from . import models |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KPk (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': 'Customize Login Page Style', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Extra Tools', |
|||
'summary': 'Customize The Login Page With Different Styles', |
|||
'description': 'The Module helps to customize login page with different ' |
|||
'styles', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['base','base_setup','web'], |
|||
'data': [ |
|||
'views/res_config_settings_views.xml', |
|||
'views/webclient_templates_right.xml', |
|||
'views/webclient_templates_left.xml', |
|||
'views/webclient_templates_middle.xml', |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import main |
@ -0,0 +1,134 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: MAyana KP (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
import hashlib |
|||
import odoo |
|||
from odoo import http |
|||
from odoo.tools import pycompat |
|||
from odoo.tools.translate import _ |
|||
from odoo.http import request |
|||
from odoo.addons.web.controllers.home import Home as WebHome |
|||
from odoo.addons.web.controllers.utils import ensure_db, _get_login_redirect_url |
|||
|
|||
# Shared parameters for all login/signup flows |
|||
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'} |
|||
|
|||
|
|||
class Home(WebHome): |
|||
@http.route(route='/web/login', type='http', auth="none") |
|||
def web_login(self, redirect=None, **kw): |
|||
"""Override web_login function to add features of this module.""" |
|||
ensure_db() |
|||
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.update_env(user=odoo.SUPERUSER_ID) |
|||
values = {val: item for val, item in request.params.items() if |
|||
val in SIGN_UP_REQUEST_PARAMS} |
|||
try: |
|||
values['databases'] = http.db_list() |
|||
except odoo.exceptions.AccessDenied: |
|||
values['databases'] = None |
|||
if request.httprequest.method == 'POST': |
|||
old_uid = request.update_env(user=request.session.uid) |
|||
try: |
|||
credential = {'login': request.params['login'], 'password': request.params['password'], |
|||
'type': 'password'} |
|||
uid = request.session.authenticate(request.session.db, credential) |
|||
request.params['login_success'] = True |
|||
return request.redirect( |
|||
self._login_redirect(uid, redirect=redirect)) |
|||
except odoo.exceptions.AccessDenied as e: |
|||
request.update_env = old_uid |
|||
if e.args == odoo.exceptions.AccessDenied().args: |
|||
values['error'] = _("Wrong login/password") |
|||
else: |
|||
values['error'] = e.args[0] |
|||
else: |
|||
if 'error' in request.params and request.params.get( |
|||
'error') == 'access': |
|||
values['error'] = _( |
|||
'Only employees can access this database. ' |
|||
'Please contact the administrator.') |
|||
if 'login' not in values and request.session.get('auth_login'): |
|||
values['login'] = request.session.get('auth_login') |
|||
if not odoo.tools.config['list_db']: |
|||
values['disable_database_manager'] = True |
|||
conf_param = request.env['ir.config_parameter'].sudo() |
|||
orientation = conf_param.get_param('web_login_styles.orientation') |
|||
image = conf_param.get_param('web_login_styles.image') |
|||
url = conf_param.get_param('web_login_styles.url') |
|||
background_type = conf_param.get_param('web_login_styles.background') |
|||
if background_type == 'color': |
|||
values['bg'] = '' |
|||
values['color'] = conf_param.sudo().get_param( |
|||
'web_login_styles.color') |
|||
elif background_type == 'image': |
|||
exist_rec = request.env['ir.attachment'].sudo().search( |
|||
[('is_background', '=', True)]) |
|||
if exist_rec: |
|||
exist_rec.unlink() |
|||
attachments = request.env['ir.attachment'].sudo().create({ |
|||
'name': 'Background Image', |
|||
'datas': image, |
|||
'type': 'binary', |
|||
'mimetype': 'image/png', |
|||
'public': True, |
|||
'is_background': True |
|||
}) |
|||
base_url = conf_param.sudo().get_param('web.base.url') |
|||
url = base_url + '/web/image?' + 'model=ir.attachment&id=' + str( |
|||
attachments.id) + '&field=datas' |
|||
values['bg_img'] = url or '' |
|||
elif background_type == 'url': |
|||
pre_exist = request.env['ir.attachment'].sudo().search( |
|||
[('url', '=', url)]) |
|||
if not pre_exist: |
|||
attachments = request.env['ir.attachment'].sudo().create({ |
|||
'name': 'Background Image URL', |
|||
'url': url, |
|||
'type': 'url', |
|||
'public': True |
|||
}) |
|||
else: |
|||
attachments = pre_exist |
|||
encode = hashlib.md5( |
|||
pycompat.to_text(attachments.url).encode("utf-8")).hexdigest()[ |
|||
0:7] |
|||
encode_url = "/web/image/{}-{}".format(attachments.id, encode) |
|||
values['bg_img'] = encode_url or '' |
|||
if orientation == 'right': |
|||
response = request.render('web_login_styles.login_template_right', |
|||
values) |
|||
elif orientation == 'left': |
|||
response = request.render('web_login_styles.login_template_left', |
|||
values) |
|||
elif orientation == 'middle': |
|||
response = request.render('web_login_styles.login_template_middle', |
|||
values) |
|||
else: |
|||
response = request.render('web.login', values) |
|||
response.headers['X-Frame-Options'] = 'DENY' |
|||
return response |
@ -0,0 +1,6 @@ |
|||
## Module <web_login_styles> |
|||
|
|||
#### 08.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial Commit for Customize Login Page Style. |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import res_config_settings |
|||
from . import ir_attachment |
|||
|
@ -0,0 +1,30 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class IrAttachment(models.Model): |
|||
"""Inherit 'ir.attachment' to add field""" |
|||
_inherit = 'ir.attachment' |
|||
|
|||
is_background = fields.Boolean(string="Is Background", default=False, |
|||
help="To check is background option added") |
@ -0,0 +1,69 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class ResConfigSettings(models.TransientModel): |
|||
"""Inherits 'res.config.settings' to add fields for customize login page.""" |
|||
_inherit = 'res.config.settings' |
|||
|
|||
orientation = fields.Selection(selection=[('default', 'Default'), |
|||
('left', 'Left'), |
|||
('middle', 'Middle'), |
|||
('right', 'Right')], |
|||
string="Orientation", |
|||
help="Type of login page visibility", |
|||
config_parameter="web_login_styles.orientation") |
|||
background = fields.Selection(selection=[('color', 'Color Picker'), |
|||
('image', 'Image'), |
|||
('url', 'URL')], |
|||
string="Background", |
|||
help="Background of the login page", |
|||
config_parameter="web_login_styles.background") |
|||
image = fields.Binary(string="Image", help="Select background image " |
|||
"of login page") |
|||
url = fields.Char(string="URL", help="Select and url of image", |
|||
config_parameter="web_login_styles.url") |
|||
color = fields.Char(string="Color", help="Set a colour for background " |
|||
"of login page", |
|||
config_parameter="web_login_styles.color") |
|||
|
|||
@api.model |
|||
def get_values(self): |
|||
"""Super the get_values function to get the field values.""" |
|||
res = super(ResConfigSettings, self).get_values() |
|||
params = self.env['ir.config_parameter'].sudo() |
|||
res.update(image=params.get_param('web_login_styles.image')) |
|||
return res |
|||
|
|||
def set_values(self): |
|||
"""Super the set_values function to save the field values.""" |
|||
super(ResConfigSettings, self).set_values() |
|||
params = self.env['ir.config_parameter'].sudo() |
|||
params.set_param('web_login_styles.image', self.image) |
|||
|
|||
@api.onchange('orientation') |
|||
def onchange_orientation(self): |
|||
"""Set background field to false for hiding option to customize login |
|||
page background """ |
|||
if self.orientation == 'default': |
|||
self.background = False |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 241 KiB |
After Width: | Height: | Size: 270 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 539 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 130 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 8.5 KiB |