@ -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 |
|||
|
|||
SignUp With Mobile |
|||
================== |
|||
* This module allow to Signup with Mobile Number |
|||
|
|||
Configuration |
|||
============= |
|||
* Install twilio [$ pip install twilio]. |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
* Developers: (V16) Busthana Shirin, |
|||
(V17) Fathima Mazlin AM, |
|||
(V18) ADARSH K, |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@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: Cybrosys Techno Solutions(<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,53 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<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': 'SignUp With Mobile', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Extra Tools', |
|||
'summary': 'A Module For SignUp With Mobile Number.', |
|||
'description': """Module helps users sign up using their mobile number |
|||
and verify it with a one-time password (OTP) by Twilio. Additionally, the |
|||
option to sign up with an email ID is also available""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['portal', 'auth_signup', 'mail'], |
|||
'data': [ |
|||
'views/res_config_setting_views.xml', |
|||
'views/signup_templates.xml', |
|||
], |
|||
'assets': { |
|||
'web.assets_frontend': [ |
|||
'signup_with_twilio/static/src/css/signup.css', |
|||
'signup_with_twilio/static/**/*', |
|||
], |
|||
}, |
|||
'external_dependencies': { |
|||
'python': ['twilio'] |
|||
}, |
|||
'images': ['static/description/banner.jpg'], |
|||
'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: Cybrosys Techno Solutions(<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 signup_with_twilio |
@ -0,0 +1,112 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<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 logging |
|||
import werkzeug |
|||
import werkzeug.exceptions |
|||
import werkzeug.utils |
|||
import werkzeug.wrappers |
|||
import werkzeug.wsgi |
|||
from twilio.rest import Client |
|||
from odoo import http, _ |
|||
from odoo.http import request |
|||
from odoo.exceptions import UserError |
|||
from odoo.addons.web.controllers.home import Home |
|||
from odoo.addons.mail.tools.discuss import get_twilio_credentials |
|||
from odoo.addons.auth_signup.models.res_users import SignupError |
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class AuthSignupHome(Home): |
|||
"""Uses to signup with mobile number and |
|||
login with the same mobile number""" |
|||
|
|||
@http.route('/web/signup-mobile', type='http', auth='public', |
|||
website=True, sitemap=False) |
|||
def web_auth_signup_mobile(self, *args, **kw): |
|||
"""Create new user with mobile number""" |
|||
qcontext = self.get_auth_signup_qcontext() |
|||
if kw.get('country_code') and kw.get('login_mobile'): |
|||
qcontext.update({'login': kw.get('country_code') + kw.get( |
|||
'login_mobile')}) |
|||
kw.update({'login': kw.get('country_code') + kw.get( |
|||
'login_mobile')}) |
|||
if not qcontext.get('token') and not qcontext.get('signup_enabled'): |
|||
raise werkzeug.exceptions.NotFound() |
|||
if 'error' not in qcontext and request.httprequest.method == 'POST': |
|||
try: |
|||
self.do_signup(qcontext) |
|||
user = request.env['res.users'].sudo().search( |
|||
[('login', '=', qcontext['login'])]) |
|||
if user.partner_id and kw.get('signup_mobile'): |
|||
user.partner_id.update({'email': ''}) |
|||
user.partner_id.update({'phone': qcontext['login']}) |
|||
return self.web_login(*args, **kw) |
|||
except UserError as e: |
|||
qcontext['error'] = e.args[0] |
|||
except (SignupError, AssertionError) as e: |
|||
if request.env["res.users"].sudo().search( |
|||
[("login", "=", qcontext.get("login"))]): |
|||
qcontext["error"] = _( |
|||
"Another user is already registered " |
|||
"using this Mobile Number.") |
|||
else: |
|||
_logger.error("%s", e) |
|||
qcontext['error'] = _("Could not create a new account.") |
|||
response = request.render('signup_with_twilio.signup_mobile', qcontext) |
|||
response.headers['X-Frame-Options'] = 'SAMEORIGIN' |
|||
response.headers['Content-Security-Policy'] = "frame-ancestors 'self'" |
|||
return response |
|||
|
|||
@http.route('/web/login', type='http', auth="public", website=True) |
|||
def web_login(self, redirect=None, **kw): |
|||
"""Update the parameters to login with mobile Number""" |
|||
request.params.update({'login': kw.get('login')}) |
|||
return super().web_login(**kw) |
|||
|
|||
@http.route('/web/send_otp', auth='public', type='json') |
|||
def web_send_otp(self, **kw): |
|||
"""Sent OTP through SMS to the given number using twilio""" |
|||
(account_sid, auth_token) = get_twilio_credentials(request.env) |
|||
from_number = request.env['ir.config_parameter'].sudo().get_param( |
|||
'signup_with_twilio.twilio_from_number') |
|||
if not account_sid or not auth_token or not from_number: |
|||
raise UserError(_('Twilio Credential are Required')) |
|||
client = Client(account_sid, auth_token) |
|||
message = client.messages.create( |
|||
to='+' + kw.get('country_code') + kw.get('mobile'), |
|||
from_=from_number, |
|||
body='Your Odoo verification code is:' + str(kw.get('otp')) + |
|||
'.OTP valid till 2 minutes.' |
|||
) |
|||
_logger.info('Message successfully sent to your mobie number: %s', |
|||
message.sid) |
|||
|
|||
@http.route('/web/reset_password', type='http', auth='public', |
|||
website=True, sitemap=False) |
|||
def web_auth_reset_password(self, *args, **kw): |
|||
"""Update the email in user email field""" |
|||
if kw.get('login-mail'): |
|||
user = request.env['res.users'].sudo().search( |
|||
[('login', '=', kw.get('login'))]) |
|||
if user: |
|||
user.email = kw.get('login-mail') |
|||
return super(AuthSignupHome, self).web_auth_reset_password(args, **kw) |
@ -0,0 +1,6 @@ |
|||
## Module <signup_with_twilio> |
|||
|
|||
#### 04.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial Commit for SignUp With Mobile |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<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 |
@ -0,0 +1,32 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<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 ResConfigSettings(models.TransientModel): |
|||
""" Inherit the base settings to add a twilio from number """ |
|||
_inherit = 'res.config.settings' |
|||
|
|||
twilio_from_number = fields.Char( |
|||
string='Twilio From Number', help="From number which used to send sms " |
|||
"from the number", |
|||
config_parameter='signup_with_twilio.twilio_from_number') |
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: 1.0 MiB |
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: 90 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 125 KiB |
After Width: | Height: | Size: 9.7 KiB |
@ -0,0 +1,36 @@ |
|||
.signup-link{ |
|||
position: relative; |
|||
margin-left: 29%; |
|||
} |
|||
.country-and-mobile-number{ |
|||
display: flex; |
|||
flex-direction: row; |
|||
position: center; |
|||
} |
|||
.div_code{ |
|||
height: 30px; |
|||
} |
|||
.login_mobile{ |
|||
height: 31px; |
|||
} |
|||
.field-phone col-lg-3 { |
|||
width: 200px; /* Adjust the width as needed */ |
|||
overflow: hidden; |
|||
color: red; |
|||
} |
|||
|
|||
.field-phone col-lg-3 { |
|||
height: 150px; /* Adjust the height as needed */ |
|||
overflow-y: scroll; |
|||
} |
|||
|
|||
/* Style the options within the custom dropdown */ |
|||
.div_code option { |
|||
padding: 10px; |
|||
} |
|||
|
|||
.oe_signup_form_mobile{ |
|||
max-width: 300px; |
|||
position: relative; |
|||
margin: 50px auto; |
|||
} |
@ -0,0 +1,57 @@ |
|||
/** @odoo-module **/ |
|||
import publicWidget from "@web/legacy/js/public/public_widget"; |
|||
import { rpc } from "@web/core/network/rpc"; |
|||
|
|||
publicWidget.registry.SignUpFormExtension = publicWidget.Widget.extend({ |
|||
selector: '.oe_signup_form_mobile, .oe_reset_password_form', |
|||
events: { |
|||
'click .sent-otp': '_onClick', |
|||
'change .check_login': '_onClickCheck', |
|||
'click button[type="submit"]': '_onSubmitClick', |
|||
}, |
|||
init() { |
|||
this._super(...arguments); |
|||
}, |
|||
_onClick: function (ev) { |
|||
/** OTP will be create and collect the to number and redirected |
|||
to the twilio function o send the otp, and enable the signup |
|||
button to signup the user **/ |
|||
ev.stopPropagation(); |
|||
ev.preventDefault(); |
|||
this.$('.sign-up').removeAttr('disabled'); |
|||
this.$('.sent-otp').attr('disabled','disabled'); |
|||
const CountryCode = $(".div_code")[0].value |
|||
const Mobile = $(".login_mobile")[0].value |
|||
let OTP = ''; |
|||
var digits = '0123456789'; |
|||
for (let i = 0; i < 4; i++ ) { |
|||
OTP += digits[Math.floor(Math.random() * 10)]; |
|||
} |
|||
window.localStorage.setItem("OTP", OTP) |
|||
rpc('/web/send_otp', { |
|||
'country_code' : CountryCode, |
|||
'mobile': Mobile, |
|||
'otp': OTP, |
|||
}) |
|||
}, |
|||
_onSubmitClick: function (ev) { |
|||
/**Signup button will check the sent and receive otp to block the |
|||
user creation if it is not same, and also enable the otp button to |
|||
send the sms again **/ |
|||
this.$('.sent-otp').removeAttr('disabled'); |
|||
let otp_val = $("#sms_otp_verify")[0].value |
|||
let OTP = window.localStorage.getItem("OTP") |
|||
if (OTP && otp_val && OTP != otp_val){ |
|||
ev.preventDefault(); |
|||
alert('OTP is not matching'); |
|||
} |
|||
}, |
|||
_onClickCheck: function (ev) { |
|||
/**This will update the email page if it has the same login**/ |
|||
let checked = $('.check_login')[0].checked |
|||
if (checked) { |
|||
$('#login_mail')[0].value = $(".field-login")[0].children[1].value |
|||
} |
|||
}, |
|||
}); |
|||
|
@ -0,0 +1,19 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Inherit the res.config.settings view to add the twilio account details--> |
|||
<record id="res_config_settings_view_form" model="ir.ui.view"> |
|||
<field name="name">res.config.settings.view.form.inherit.signup.with.twilio</field> |
|||
<field name="model">res.config.settings</field> |
|||
<field name="inherit_id" |
|||
ref="base_setup.res_config_settings_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//div[@id='mail_twilio_auth_token']" position="after"> |
|||
<div class="row mt16" id="mail_twilio_from_number"> |
|||
<label for="twilio_from_number" class="col-lg-3"/> |
|||
<field name="twilio_from_number" |
|||
placeholder="e.g. +919999999999"/> |
|||
</div> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,146 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!--Inherit the signup template to add the mobile number signup link--> |
|||
<template id="signup_with_mobile_link" inherit_id="auth_signup.signup" |
|||
name="Signup with mobile link"> |
|||
<xpath expr="//button[@type='submit']" position="after"> |
|||
<div class="justify-content-between mt-2 d-flex small signup-link"> |
|||
<a class="sign-up-mobile" style="font-size: 12px;" |
|||
t-attf-href="/web/signup-mobile?{{ keep_query() }}">SignUp |
|||
With Mobile |
|||
</a> |
|||
</div> |
|||
</xpath> |
|||
</template> |
|||
<!-- Template for signup with mobile --> |
|||
<template id="signup_with_mobile_fields" |
|||
name="Auth Signup with mobile form fields"> |
|||
<div class="mb-3 field-login-mobile"> |
|||
<label for="login_mobile">Mobile Numer</label> |
|||
<div class="country-and-mobile-number"> |
|||
<div class="mb-1 field-phone col-lg-3" id="country_code"> |
|||
<select class="div_code" name="country_code" |
|||
style="background-color: white"> |
|||
<option value=""/> |
|||
<option t-foreach="request.env['res.country'].sudo().search([])" |
|||
t-as="country" |
|||
t-att-value="country.phone_code"> |
|||
<span>+</span> |
|||
<t t-esc="country.phone_code"/> |
|||
</option> |
|||
</select> |
|||
</div> |
|||
<div class="mb-1 field-phone col-lg-9" id="div_number"> |
|||
<input type="text" name="login_mobile" |
|||
t-att-value="login_mobile" |
|||
class="login_mobile form-control form-control-sm" |
|||
autofocus="autofocus" autocapitalize="off" |
|||
required="required" |
|||
t-att-readonly="'readonly' if only_passwords else None"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="otp-verification"> |
|||
<label for="otp_verify">OTP Verification</label> |
|||
<div class="mb-3 otp_verify" |
|||
style="display: flex; flex-direction: row;"> |
|||
<div class="mb-1 sms-validate col-lg-6"> |
|||
<input type="text" name="sms_otp" t-att-value="sms_otp" |
|||
id="sms_otp_verify" |
|||
class="form-control" autofocus="autofocus" |
|||
required="required" |
|||
style="height: 32px; margin-right:5px;"/> |
|||
</div> |
|||
<button name="sent_otp_sms" |
|||
style="height: 32px; margin-left:5px; border-radius: 20px; padding-bottom: 27px" |
|||
class="btn btn-primary sent-otp col-lg-6" |
|||
role="button">Sent OTP |
|||
</button> |
|||
</div> |
|||
</div> |
|||
<div class="mb-3 field-name"> |
|||
<label for="name">Your Name</label> |
|||
<input type="text" name="name" t-att-value="name" id="name" |
|||
class="form-control form-control-sm" |
|||
placeholder="e.g. John Doe" |
|||
required="required" |
|||
t-att-readonly="'readonly' if only_passwords else None" |
|||
t-att-autofocus="'autofocus' if login and not only_passwords else None"/> |
|||
</div> |
|||
<div class="mb-3 field-password pt-2"> |
|||
<label for="password">Password</label> |
|||
<input type="password" name="password" id="password" |
|||
class="form-control form-control-sm" |
|||
required="required" |
|||
t-att-autofocus="'autofocus' if only_passwords else None"/> |
|||
</div> |
|||
<div class="mb-3 field-confirm_password"> |
|||
<label for="confirm_password">Confirm Password</label> |
|||
<input type="password" name="confirm_password" |
|||
id="confirm_password" |
|||
class="form-control form-control-sm" |
|||
required="required"/> |
|||
</div> |
|||
</template> |
|||
<!-- Template for signup with mobile --> |
|||
<template id="signup_mobile" name="Sign up login"> |
|||
<t t-call="web.login_layout"> |
|||
<form class="oe_signup_form_mobile" role="form" method="post" |
|||
t-if="not message"> |
|||
<input type="hidden" name="csrf_token" |
|||
t-att-value="request.csrf_token()"/> |
|||
<t t-call="signup_with_twilio.signup_with_mobile_fields"> |
|||
<t t-set="only_passwords" |
|||
t-value="bool(token and not invalid_token)"/> |
|||
</t> |
|||
<p class="alert alert-danger" t-if="error" role="alert"> |
|||
<t t-esc="error"/> |
|||
</p> |
|||
<input type="hidden" name="redirect" t-att-value="redirect"/> |
|||
<input type="hidden" name="token" t-att-value="token"/> |
|||
<input type="hidden" name="signup_mobile" t-att-value="True"/> |
|||
<div class="text-center oe_login_buttons d-grid pt-3"> |
|||
<button type="submit" class="btn btn-primary sign-up">Sign |
|||
up |
|||
</button> |
|||
<a t-attf-href="/web/login?{{ keep_query() }}" |
|||
class="btn btn-link btn-sm" role="button">Already have an |
|||
account? |
|||
</a> |
|||
<div class="o_login_auth"/> |
|||
</div> |
|||
</form> |
|||
</t> |
|||
</template> |
|||
<!-- Inherit the reset password template to add the mobile number--> |
|||
<template id="sign_up_mobile_reset_password" |
|||
inherit_id="auth_signup.reset_password" |
|||
name="Reset password"> |
|||
<xpath expr="//div[@class='mb-3 field-login']/label" |
|||
position="replace"> |
|||
<label for="login" class="col-form-label">Login Email/Mobile |
|||
Number |
|||
</label> |
|||
</xpath> |
|||
<xpath expr="//form[@class='oe_reset_password_form']/t[2]" |
|||
position="after"> |
|||
<div class="check-login"> |
|||
<input type="checkbox" name="check-login" class="check_login"> |
|||
<span>Mail as same as login</span> |
|||
</input> |
|||
</div> |
|||
<t t-if="not token"> |
|||
<div class="mb-3 field-email"> |
|||
<label for="login_mail" class="col-form-label">Mail to send |
|||
Password |
|||
</label> |
|||
<input type="text" name="login-mail" |
|||
t-att-value="login_mail" |
|||
id="login_mail" class="form-control" |
|||
autofocus="autofocus" required="required" |
|||
autocapitalize="off"/> |
|||
</div> |
|||
</t> |
|||
</xpath> |
|||
</template> |
|||
</odoo> |