Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/15.0-develop' into 15.0-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
vineela-ampili committed Nov 6, 2023
2 parents 368989f + e42c703 commit 1e96c75
Show file tree
Hide file tree
Showing 12 changed files with 290 additions and 2 deletions.
1 change: 1 addition & 0 deletions g2p_theme/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import controllers
11 changes: 9 additions & 2 deletions g2p_theme/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@
"author": "OpenG2P",
"website": "https://openg2p.org",
"license": "Other OSI approved licence",
"depends": ["base", "web"],
"depends": ["base", "web", "auth_signup"],
"development_status": "Alpha",
"data": ["data/res_company_data.xml", "templates/g2p_login_page.xml"],
"data": [
"data/res_company_data.xml",
"templates/g2p_login_page.xml",
"templates/g2p_reset_password.xml",
],
"assets": {
"web.assets_backend": [
# "g2p_theme/static/src/scss/assets_menu.scss",
"g2p_theme/static/src/js/g2p_window_title.js",
"g2p_theme/static/src/css/style.css",
],
"web.assets_frontend": [
"g2p_theme/static/src/scss/new_login_page.scss",
],
"web.assets_qweb": [],
},
"demo": [],
Expand Down
1 change: 1 addition & 0 deletions g2p_theme/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import web_login
18 changes: 18 additions & 0 deletions g2p_theme/controllers/web_login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from odoo import http
from odoo.tools.translate import _

from odoo.addons.web.controllers.main import Home


class WebLoginHome(Home):
@http.route()
def web_login(self, redirect=None, **kw):
response = super().web_login()
if "error" in response.qcontext:
error_message = response.qcontext["error"]
if error_message == _("Wrong login/password"):
# Change the error message to your desired message
response.qcontext["error"] = _(
"Login failed due to Invalid credentials !"
)
return response
1 change: 1 addition & 0 deletions g2p_theme/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import res_company
from . import res_user
18 changes: 18 additions & 0 deletions g2p_theme/models/res_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from odoo import _, models


class ResUser(models.Model):
_inherit = "res.users"

def reset_password(self, login):
"""retrieve the user corresponding to login (login or email),
and reset their password
"""
users = self.search([("login", "=", login)])
if not users:
users = self.search([("email", "=", login)])
if len(users) != 1:
raise Exception(
_("Incorrect email. Please enter the registered email address.")
)
return users.action_reset_password()
4 changes: 4 additions & 0 deletions g2p_theme/static/src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -434,3 +434,7 @@ main {
height: 31px;
color: #ffffff !important;
}

.info-message {
color: #ed9834;
}
Binary file added g2p_theme/static/src/img/57481.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added g2p_theme/static/src/img/57485.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
153 changes: 153 additions & 0 deletions g2p_theme/static/src/scss/new_login_page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
main:has(.g2p_login) {
top: 0px;
left: 0px;
width: 100%;
height: 750px;
/* UI Properties */
background: #fff7dd 0% 0% no-repeat padding-box;
opacity: 1;
}

.g2p_login .oe_login_form:not(.ssp-signup-body),
.g2p_login .oe_signup_form:not(.ssp-signup-body),
.g2p_login .oe_reset_password_form:not(.ssp-signup-body) {
max-width: 444px !important;
// max-height: 486px;
position: relative;
margin: 50px auto;
top: 100px;
background: #ffffff 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 15px #0000000d;
border-radius: 20px;
opacity: 1;
padding: 25px;
}

/* Initial button style */
.g2p_login .oe_login_buttons .btn-primary {
background-color: #e0711a;
border-color: #e0711a;
}

/* Button hover style */
.g2p_login .oe_login_buttons .btn-primary:hover {
border-color: #6569c7;
background: #6569c7 0% 0% no-repeat padding-box;
opacity: 1;
}

/* Button press style */
.g2p_login .oe_login_buttons .btn-primary:active,
.g2p_login .oe_login_buttons .btn-primary:focus {
background-color: #6569c7 !important;
border-color: #6569c7 !important;
}

.g2p_login .oe_login_buttons a,
.g2p_login .oe_login_buttons a:hover {
color: #e0711a;
text-decoration: none;
font-size: 13px;
}

.g2p_login .form-control:focus {
color: #495057;
background-color: #ffffff;
border-color: rgba(224, 113, 26, 0.5) !important;
/* Change the opacity to adjust the brightness */
box-shadow: 0 0 0 0.1rem rgb(255, 149, 49) !important;
opacity: 1;
}

.g2p_login .alert-danger {
top: 102px;
max-height: 200px;
left: 50%; /* Center the element horizontally */
transform: translateX(-50%); /* Center horizontally */
max-width: 430px; /* Set a maximum width */
width: 100%; /* Make sure it doesn't exceed the maximum width */
/* UI Properties */
background: #db3c3c 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 15px #0000000d;
border-radius: 8px;
opacity: 1;
font-weight: normal;
font-style: normal;
font-size: 14px;
line-height: 17px;
text-align: center;
letter-spacing: 0px;
color: #ffffff;
opacity: 1;
}

.reset_g2p_pass {
/* Layout Properties */
top: 353px;
left: 491px;
width: 153px;
height: 24px;
/* UI Properties */
text-align: left;
font-family: "Inter", sans-serif;
letter-spacing: 0px;
color: #000000;
font-weight: normal;
font-style: normal;
font-size: 20px;
line-height: 24px;
margin: 30px 0 30px;
}

// .g2p_login .oe_reset_password_form {
// height: 400px !important;
// }
.g2p_login .reset-password,
.g2p_login .reset-password a {
color: #e0711a;
text-decoration: none;
float: right;
font-size: 13px;
}

.g2p_login form label {
/* Layout Properties */
top: 406px;
left: 491px;
width: 168px;
height: 17px;
/* UI Properties */
text-align: left;
font-weight: bolder;
font-family: "Inter", sans-serif;
font-style: normal !important;
font-size: 14px;
line-height: 17px;
letter-spacing: 0px;
color: #000000;
opacity: 1;
}

.g2p_login .g2p-background {
/* Layout Properties */
position: absolute;
top: 312px;
left: 227px;
width: 912px;
height: 120px;
/* UI Properties */
background: transparent url("/g2p_theme/static/src/img/57485.png") 0% 0% no-repeat padding-box;
opacity: 1;
}

/* Responsive styles for smaller screens */
@media screen and (max-width: 768px) {
.g2p_login:not(.ssp-signup-body) .alert-danger {
display: block;
}
}
@media screen and (min-width: 769px) {
.g2p_login:not(.ssp-signup-body) .alert-danger {
display: block;
}
}
48 changes: 48 additions & 0 deletions g2p_theme/templates/g2p_login_page.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,60 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="g2ptheme_login" inherit_id="auth_signup.login" name="Sign up - Reset Password">
<xpath expr="//div[@class='justify-content-between mt-2 d-flex small']" position="replace">
</xpath>
</template>

<template id="login" inherit_id="web.login" name="Login Inherit">
<xpath expr="//input[@name='login']" position="attributes">
<attribute name="placeholder" />
</xpath>
<xpath expr="//input[@name='password']" position="attributes">
<attribute name="placeholder" />
</xpath>
<xpath expr="//form" position="before">
<t t-set="no_header" t-value="True" />
<t t-set="no_footer" t-value="True" />
</xpath>
<xpath expr="//label[@for='login']" position="replace">
<label for="name">Email / Username</label>
</xpath>
<div class="form-group field-db" position="before">
<div t-attf-class="text-center pb-3 {{'mb-3' if form_small else 'mb-4'}}">
<img
t-attf-src="/web/binary/company_logo{{ '?dbname='+db if db else '' }}"
alt="Logo"
style="max-height:120px; max-width: 100%; width:auto"
/>
</div>
</div>
<xpath expr="//input[@name='login']" position="attributes">
<attribute name="placeholder">Enter email address</attribute>
</xpath>
<xpath expr="//input[@name='password']" position="attributes">
<attribute name="placeholder">Enter password</attribute>
</xpath>
<xpath expr="//form" position="before">
<div class="g2p-background" />
<xpath expr="//p[@class='alert alert-success']" position="move" />
<xpath expr="//p[@class='alert alert-danger']" position="move" />
</xpath>
<button type="submit" name="redirect" position="replace" />

<xpath expr="//label[@for='password']" position="after">
<span class="reset-password">
<a t-if="reset_password_enabled" t-attf-href="/web/reset_password?{{ keep_query() }}">Reset Password</a>
</span>
</xpath>

</template>

<template id="login_layout_inherit" inherit_id="website.login_layout" name="Website Login Layout inherit">
<xpath expr="//div[@class='oe_website_login_container']" position="attributes">
<attribute name="class" add="g2p_login" separator=" " />
</xpath>
</template>

<template id="login_layout" inherit_id="web.login_layout" name="G2P Login Layout">
<xpath
expr="//div[contains(@t-attf-class,'card') and contains(@t-attf-class,'o_database_list')]"
Expand All @@ -17,4 +64,5 @@
<attribute name="style" />
</xpath>
</template>

</odoo>
37 changes: 37 additions & 0 deletions g2p_theme/templates/g2p_reset_password.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="g2p_reset_password" inherit_id="auth_signup.reset_password" name="Inherit Reset password">
<xpath expr="//form" position="before">
<div class="g2p-background" />
<t t-set="no_header" t-value="True" />
<t t-set="no_footer" t-value="True" />
</xpath>
<xpath expr="//label[@for='login']" position="replace">
<label for="name">Your Email / Username</label>
</xpath>
<div class="form-group field-login" position="before">
<div t-attf-class="text-center pb-3 {{'mb-3' if form_small else 'mb-4'}}">
<img
t-attf-src="/web/binary/company_logo{{ '?dbname='+db if db else '' }}"
alt="Logo"
style="max-height:120px; max-width: 100%; width:auto"
/>
</div>
<p class="reset_g2p_pass">Reset Password</p>
</div>
<xpath expr="//div[hasclass('oe_login_buttons')]/div" position="attributes">
<attribute
name="class"
add="justify-content-center"
remove="justify-content-between"
separator=" "
/>
</xpath>
<xpath expr="//form" position="before">
<xpath expr="//p[@class='alert alert-danger']" position="move" />
</xpath>
<xpath expr="//p[@class='alert alert-danger']" position="attributes">
<attribute name="class" add="reset_alert" separator=" " />
</xpath>
</template>
</odoo>

0 comments on commit 1e96c75

Please sign in to comment.