[IMP] mail_plugin: do not allow portal user to use the addin

Purpose
=======
Show an error during the login process if a portal
user tries to use the Outlook / Gmail addin.

Task-3344536

closes odoo/odoo#134450

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
std-odoo
2023-09-13 08:20:33 +00:00
parent 27d51c1f10
commit 925daad7f3
2 changed files with 8 additions and 1 deletions
@@ -9,7 +9,7 @@ import logging
import odoo
import werkzeug
from odoo import http
from odoo import _, http
from odoo.http import request
from werkzeug.exceptions import NotFound
@@ -27,6 +27,8 @@ class Authenticate(http.Controller):
old route name "/mail_client_extension/auth is deprecated as of saas-14.3,it is not needed for newer
versions of the mail plugin but necessary for supporting older versions
"""
if not request.env.user._is_internal():
return request.render('mail_plugin.app_error', {'error': _('Access Error: Only Internal Users can link their inboxes to this database.')})
return request.render('mail_plugin.app_auth', values)
@http.route(['/mail_client_extension/auth/confirm', '/mail_plugin/auth/confirm'], type='http', auth="user", methods=['POST'])
@@ -19,4 +19,9 @@
</form>
</t>
</template>
<template id="mail_plugin.app_error" name="Accept app">
<t t-call="web.login_layout">
<div class="alert alert-danger" role="alert" t-out="error"/>
</t>
</template>
</odoo>