diff --git a/odex25_base/mpl_login_background/__init__.py b/odex25_base/mpl_login_background/__init__.py new file mode 100644 index 000000000..71218c49a --- /dev/null +++ b/odex25_base/mpl_login_background/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Meghsundar Private Limited(). +# +############################################################################### +from . import controllers +from . import models diff --git a/odex25_base/mpl_login_background/__manifest__.py b/odex25_base/mpl_login_background/__manifest__.py new file mode 100644 index 000000000..295ff4953 --- /dev/null +++ b/odex25_base/mpl_login_background/__manifest__.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Meghsundar Private Limited(). +# +############################################################################### +{ + 'name': 'Login Background', + 'summary': 'Configure Odoo Web Login Screen', + 'description': 'Configure Odoo Web Login Screen', + 'version': '14.0.1', + 'license': 'AGPL-3', + 'author': 'Meghsundar Private Limited', + 'website': 'https://meghsundar.com', + 'category': 'Web', + 'depends': ['base', 'base_setup', 'web'], + 'data': [ + 'security/ir.model.access.csv', + 'views/res_config_settings_views_inherit.xml', + 'views/image_login.xml', + 'templates/left_login_template.xml', + 'templates/right_login_template.xml', + 'templates/middle_login_template.xml', + 'templates/assets.xml', + ], + 'images': ['static/description/banner.gif'], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/odex25_base/mpl_login_background/controllers/__init__.py b/odex25_base/mpl_login_background/controllers/__init__.py new file mode 100644 index 000000000..41c92fe21 --- /dev/null +++ b/odex25_base/mpl_login_background/controllers/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Meghsundar Private Limited(). +# +############################################################################### +from . import main diff --git a/odex25_base/mpl_login_background/controllers/main.py b/odex25_base/mpl_login_background/controllers/main.py new file mode 100644 index 000000000..eda1f4021 --- /dev/null +++ b/odex25_base/mpl_login_background/controllers/main.py @@ -0,0 +1,127 @@ +import logging +import werkzeug.exceptions +import werkzeug.utils +from werkzeug.urls import iri_to_uri +import odoo +from odoo.tools.translate import _ +from odoo import http, tools +from odoo.http import request, Response + +_logger = logging.getLogger(__name__) +db_monodb = http.db_monodb + + +def _get_login_redirect_url(uid, redirect=None): + if request.session.uid: # fully logged + return redirect or '/web' + url = request.env(user=uid)['res.users'].browse(uid)._mfa_url() + if not redirect: + return url + parsed = werkzeug.urls.url_parse(url) + qs = parsed.decode_query() + qs['redirect'] = redirect + return parsed.replace(query=werkzeug.urls.url_encode(qs)).to_url() + + +def abort_and_redirect(url): + r = request.httprequest + response = werkzeug.utils.redirect(url, 302) + response = r.app.get_response(r, response, explicit_session=False) + werkzeug.exceptions.abort(response) + + +def ensure_db(redirect='/web/database/selector'): + db = request.params.get('db') and request.params.get('db').strip() + if db and db not in http.db_filter([db]): + db = None + if db and not request.session.db: + r = request.httprequest + url_redirect = werkzeug.urls.url_parse(r.base_url) + if r.query_string: + query_string = iri_to_uri(r.query_string) + url_redirect = url_redirect.replace(query=query_string) + request.session.db = db + abort_and_redirect(url_redirect) + if not db and request.session.db and http.db_filter([request.session.db]): + db = request.session.db + if not db: + db = db_monodb(request.httprequest) + if not db: + werkzeug.exceptions.abort(werkzeug.utils.redirect(redirect, 303)) + if db != request.session.db: + request.session.logout() + abort_and_redirect(request.httprequest.url) + request.session.db = db + + +class Home(http.Controller): + + def _login_redirect(self, uid, redirect=None): + return _get_login_redirect_url(uid, redirect) + + @http.route('/web/login', type='http', auth="none") + def web_login(self, redirect=None, **kw): + ensure_db() + request.params['login_success'] = False + if request.httprequest.method == 'GET' and redirect and request.session.uid: + return http.redirect_with_hash(redirect) + if not request.uid: + request.uid = odoo.SUPERUSER_ID + values = request.params.copy() + try: + values['databases'] = http.db_list() + except odoo.exceptions.AccessDenied: + values['databases'] = None + if request.httprequest.method == 'POST': + old_uid = request.uid + try: + uid = request.session.authenticate(request.session.db, request.params['login'], + request.params['password']) + request.params['login_success'] = True + return http.redirect_with_hash(self._login_redirect(uid, redirect=redirect)) + except odoo.exceptions.AccessDenied as e: + request.uid = 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 + + param_obj = request.env['ir.config_parameter'].sudo() + style = param_obj.get_param('mpl_login_background.style') + background = param_obj.get_param('mpl_login_background.background') + values['background_color'] = param_obj.get_param('mpl_login_background.color') + b_image = param_obj.get_param('mpl_login_background.b_image') + + if background == 'image': + image_url = '' + if b_image: + base_url = param_obj.get_param('web.base.url') + image_url = base_url + '/web/image?' + 'model=image.login&id=' + b_image + '&field=image' + values['background_src'] = image_url or '' + values['background_color'] = '' + if background == 'color': + values['background_src'] = '' + if style == 'default' or style is False: + response = request.render('web.login', values) + elif style == 'left': + response = request.render('mpl_login_background.left_login_template', values) + elif style == 'right': + response = request.render('mpl_login_background.right_login_template', values) + else: + response = request.render('mpl_login_background.middle_login_template', values) + response.headers['X-Frame-Options'] = 'DENY' + return response + + +class Website(Home): + + @http.route(website=True, auth="public", sitemap=False) + def web_login(self, *args, **kw): + return super().web_login(*args, **kw) diff --git a/odex25_base/mpl_login_background/models/__init__.py b/odex25_base/mpl_login_background/models/__init__.py new file mode 100644 index 000000000..7c213dfc3 --- /dev/null +++ b/odex25_base/mpl_login_background/models/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Meghsundar Private Limited(). +# +############################################################################### +from . import res_config_settings_inherit +from . import image_login \ No newline at end of file diff --git a/odex25_base/mpl_login_background/models/image_login.py b/odex25_base/mpl_login_background/models/image_login.py new file mode 100644 index 000000000..12065a10c --- /dev/null +++ b/odex25_base/mpl_login_background/models/image_login.py @@ -0,0 +1,10 @@ +from odoo import models, fields, api, _ + + +class LoginImage(models.Model): + _name = 'image.login' + _description = 'Image Login' + _rec_name = 'name' + + image = fields.Binary(string="Image") + name = fields.Char(string="Name") diff --git a/odex25_base/mpl_login_background/models/res_config_settings_inherit.py b/odex25_base/mpl_login_background/models/res_config_settings_inherit.py new file mode 100644 index 000000000..ee2537630 --- /dev/null +++ b/odex25_base/mpl_login_background/models/res_config_settings_inherit.py @@ -0,0 +1,48 @@ +from odoo import api, fields, models, modules + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + style = fields.Selection([ + ('left', 'Left'), + ('right', 'Right'), + ('middle', 'Middle')], default='middle', help='Select Background Theme') + background = fields.Selection([('image', 'Image'), ('color', 'Color')], default='color', help='Select Background Theme') + b_image = fields.Many2one('image.login', string="Image", help='Select Background Image For Login Page') + color = fields.Char(string="Color", help="Choose your Background color") + + @api.onchange('background') + def onchange_background(self): + if self.background == 'image': + self.color = False + elif self.background == 'color': + self.b_image = False + else: + self.b_image = self.color = False + + @api.model + def get_values(self): + res = super(ResConfigSettings, self).get_values() + image_id = int(self.env['ir.config_parameter'].sudo().get_param('mpl_login_background.b_image')) + res.update( + b_image=image_id, + color=self.env['ir.config_parameter'].sudo().get_param('mpl_login_background.color'), + background=self.env['ir.config_parameter'].sudo().get_param('mpl_login_background.background'), + style=self.env['ir.config_parameter'].sudo().get_param('mpl_login_background.style'), + ) + return res + + def set_values(self): + super(ResConfigSettings, self).set_values() + param = self.env['ir.config_parameter'].sudo() + + set_image = self.b_image.id or False + set_color = self.color or False + set_background = self.background or False + set_style = self.style or False + + param.set_param('mpl_login_background.b_image', set_image) + param.set_param('mpl_login_background.color', set_color) + param.set_param('mpl_login_background.background', set_background) + param.set_param('mpl_login_background.style', set_style) diff --git a/odex25_base/mpl_login_background/security/ir.model.access.csv b/odex25_base/mpl_login_background/security/ir.model.access.csv new file mode 100644 index 000000000..bf89c8721 --- /dev/null +++ b/odex25_base/mpl_login_background/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_image_login,access_image_login,model_image_login,,1,1,1,1 diff --git a/odex25_base/mpl_login_background/static/description/1.png b/odex25_base/mpl_login_background/static/description/1.png new file mode 100644 index 000000000..9cb581e39 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/1.png differ diff --git a/odex25_base/mpl_login_background/static/description/2.png b/odex25_base/mpl_login_background/static/description/2.png new file mode 100644 index 000000000..bed94aa69 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/2.png differ diff --git a/odex25_base/mpl_login_background/static/description/3.png b/odex25_base/mpl_login_background/static/description/3.png new file mode 100644 index 000000000..c034c5947 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/3.png differ diff --git a/odex25_base/mpl_login_background/static/description/4.png b/odex25_base/mpl_login_background/static/description/4.png new file mode 100644 index 000000000..72d730720 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/4.png differ diff --git a/odex25_base/mpl_login_background/static/description/Thumbs.db b/odex25_base/mpl_login_background/static/description/Thumbs.db new file mode 100644 index 000000000..7625bd355 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/Thumbs.db differ diff --git a/odex25_base/mpl_login_background/static/description/banner.gif b/odex25_base/mpl_login_background/static/description/banner.gif new file mode 100644 index 000000000..bcbbb4384 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/banner.gif differ diff --git a/odex25_base/mpl_login_background/static/description/icon.png b/odex25_base/mpl_login_background/static/description/icon.png new file mode 100644 index 000000000..50ba4af8e Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/icon.png differ diff --git a/odex25_base/mpl_login_background/static/description/img.png b/odex25_base/mpl_login_background/static/description/img.png new file mode 100644 index 000000000..1996670c5 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/img.png differ diff --git a/odex25_base/mpl_login_background/static/description/index.html b/odex25_base/mpl_login_background/static/description/index.html new file mode 100644 index 000000000..848ac1eed --- /dev/null +++ b/odex25_base/mpl_login_background/static/description/index.html @@ -0,0 +1,260 @@ + + + + + + + Description + + + +
+
+
+ +
+
+

info@meghsundar.com | +919426550327 | 24x7 Service

+
+
+
+
+

Odoo Implementation | Odoo Training | Odoo Customization | Odoo Integration

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

+ Configure Login Page by image or color +

+
+
+

Main Features

+

+

+ Configure Login Page by image or color

+
+
+

+ Set image for login page

+
+ +
+
+ +
+
+

+ Image at login page

+
+ +
+
+ +
+

+ Set color for login page

+
+ +
+
+

+ Color at login page

+
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
    +
    Our + Service
    +
+
+
+
+
+ +

+ Odoo Migration

+
+
+
+
+ +

+ Odoo Training

+
+
+
+
+ +

+ Odoo Customization

+
+
+
+
+ +

+ Odoo Implementation

+
+
+
+
+ +

+ Odoo Integration

+
+
+
+
+ +

+ Odoo Consulting

+
+
+
+
+ +

+ Odoo Support

+
+
+
+
+ +

+ Odoo Hire

+
+
+
+
+ +

+ Website Development

+
+
+
+
+ +

+ App Development

+
+
+
+
+ +

+ SEO

+
+
+
+
+
+
+ +
+
+
+
+
+
    +
    + Get Help & Support +
    +
  • You will get + 30 Days free support incase any bugs or issue. +
  • +
    +
+
+
+
+
+
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/odex25_base/mpl_login_background/static/description/mail.png b/odex25_base/mpl_login_background/static/description/mail.png new file mode 100644 index 000000000..7f7362f20 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/mail.png differ diff --git a/odex25_base/mpl_login_background/static/description/meghsundar.jpg b/odex25_base/mpl_login_background/static/description/meghsundar.jpg new file mode 100644 index 000000000..238363ad8 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/meghsundar.jpg differ diff --git a/odex25_base/mpl_login_background/static/description/meghsundar_logo_footer.png b/odex25_base/mpl_login_background/static/description/meghsundar_logo_footer.png new file mode 100644 index 000000000..da0cf0d0e Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/meghsundar_logo_footer.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Consulting.png b/odex25_base/mpl_login_background/static/description/service/Consulting.png new file mode 100644 index 000000000..bdbaba7d4 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Consulting.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Customization.png b/odex25_base/mpl_login_background/static/description/service/Customization.png new file mode 100644 index 000000000..eabb76a95 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Customization.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Hire.png b/odex25_base/mpl_login_background/static/description/service/Hire.png new file mode 100644 index 000000000..5a97e8b4b Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Hire.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Implementation.png b/odex25_base/mpl_login_background/static/description/service/Implementation.png new file mode 100644 index 000000000..957fda783 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Implementation.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Installation.png b/odex25_base/mpl_login_background/static/description/service/Installation.png new file mode 100644 index 000000000..50313cf7a Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Installation.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Integration.png b/odex25_base/mpl_login_background/static/description/service/Integration.png new file mode 100644 index 000000000..35ad5b311 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Integration.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Migration.png b/odex25_base/mpl_login_background/static/description/service/Migration.png new file mode 100644 index 000000000..2a4367cbf Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Migration.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Support.png b/odex25_base/mpl_login_background/static/description/service/Support.png new file mode 100644 index 000000000..5f56aed24 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Support.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/Training.png b/odex25_base/mpl_login_background/static/description/service/Training.png new file mode 100644 index 000000000..342c5ca7a Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/Training.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/cell-phone.png b/odex25_base/mpl_login_background/static/description/service/cell-phone.png new file mode 100644 index 000000000..3f551ac39 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/cell-phone.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/img.png b/odex25_base/mpl_login_background/static/description/service/img.png new file mode 100644 index 000000000..ad4bae296 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/img.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/seo.png b/odex25_base/mpl_login_background/static/description/service/seo.png new file mode 100644 index 000000000..6a2ebd350 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/seo.png differ diff --git a/odex25_base/mpl_login_background/static/description/service/website.png b/odex25_base/mpl_login_background/static/description/service/website.png new file mode 100644 index 000000000..6ede9b005 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/service/website.png differ diff --git a/odex25_base/mpl_login_background/static/description/skype.png b/odex25_base/mpl_login_background/static/description/skype.png new file mode 100644 index 000000000..80a353f69 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/skype.png differ diff --git a/odex25_base/mpl_login_background/static/description/website.png b/odex25_base/mpl_login_background/static/description/website.png new file mode 100644 index 000000000..6ede9b005 Binary files /dev/null and b/odex25_base/mpl_login_background/static/description/website.png differ diff --git a/odex25_base/mpl_login_background/static/src/css/web_login_style.css b/odex25_base/mpl_login_background/static/src/css/web_login_style.css new file mode 100644 index 000000000..ed7f2beb2 --- /dev/null +++ b/odex25_base/mpl_login_background/static/src/css/web_login_style.css @@ -0,0 +1,55 @@ +.container{ + max-width: 100%; +} +#background{ + height:100%; + display: block; + background-repeat: no-repeat; + background-position: center center; + background-attachment: fixed; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; + -webkit-filter: blur(0px); + z-index: -1; +} +.body_login { + display: inline-block; + text-align: center; + white-space: nowrap; + width: 100%; + position: relative; + margin: 0px; + padding: 0px; + opacity:0.7; +} +#mcard{ + margin-top: 7%; + padding: 3%; + max-width:350px +} + +#bcard{ + padding: 3%; + height: 100%; +} + +.body_login input, +.body_login select { + background-color: transparent !important; + border-top: 0px; + border-left: 0px; + border-right: 0px; + border-bottom: 1px solid #FED766; + border-radius: 0px; + color: black; + font-size: 18px; + font-weight: 300; + transition: border-color 0.7s ease; + box-shadow: none!important; + text-align: center; +} +.effect:hover{ + box-shadow: 5px 5px 5px black; +} \ No newline at end of file diff --git a/odex25_base/mpl_login_background/templates/assets.xml b/odex25_base/mpl_login_background/templates/assets.xml new file mode 100644 index 000000000..522bf4dfa --- /dev/null +++ b/odex25_base/mpl_login_background/templates/assets.xml @@ -0,0 +1,8 @@ + + + + diff --git a/odex25_base/mpl_login_background/templates/left_login_template.xml b/odex25_base/mpl_login_background/templates/left_login_template.xml new file mode 100644 index 000000000..1670510fa --- /dev/null +++ b/odex25_base/mpl_login_background/templates/left_login_template.xml @@ -0,0 +1,73 @@ + + + + + + \ No newline at end of file diff --git a/odex25_base/mpl_login_background/templates/middle_login_template.xml b/odex25_base/mpl_login_background/templates/middle_login_template.xml new file mode 100644 index 000000000..5e161703d --- /dev/null +++ b/odex25_base/mpl_login_background/templates/middle_login_template.xml @@ -0,0 +1,77 @@ + + + + + + \ No newline at end of file diff --git a/odex25_base/mpl_login_background/templates/right_login_template.xml b/odex25_base/mpl_login_background/templates/right_login_template.xml new file mode 100644 index 000000000..9a8006c50 --- /dev/null +++ b/odex25_base/mpl_login_background/templates/right_login_template.xml @@ -0,0 +1,73 @@ + + + + + + \ No newline at end of file diff --git a/odex25_base/mpl_login_background/views/image_login.xml b/odex25_base/mpl_login_background/views/image_login.xml new file mode 100644 index 000000000..a9d4f8679 --- /dev/null +++ b/odex25_base/mpl_login_background/views/image_login.xml @@ -0,0 +1,35 @@ + + + + + image.login + image.login + + + + + + + + + image.login + image.login + + +
+ + + + +
+
+
+ + + Image + image.login + tree,form + + +
+
\ No newline at end of file diff --git a/odex25_base/mpl_login_background/views/res_config_settings_views_inherit.xml b/odex25_base/mpl_login_background/views/res_config_settings_views_inherit.xml new file mode 100644 index 000000000..41975648c --- /dev/null +++ b/odex25_base/mpl_login_background/views/res_config_settings_views_inherit.xml @@ -0,0 +1,44 @@ + + + + + res.config.settings.form.inherit + res.config.settings + + + +
+

Login Background

+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/odex25_base/odex25_web/views/customize_menu_seurity.xml b/odex25_base/odex25_web/views/customize_menu_seurity.xml index bb410d325..9e5ad15e3 100644 --- a/odex25_base/odex25_web/views/customize_menu_seurity.xml +++ b/odex25_base/odex25_web/views/customize_menu_seurity.xml @@ -1,7 +1,7 @@ - - - + + + \ No newline at end of file