chore: handle get requests via frappe.whitelist decorator

This commit is contained in:
phot0n 2022-12-29 17:26:08 +05:30
parent b78f86a307
commit 231d90cb40
5 changed files with 3 additions and 7 deletions

View file

@ -16,7 +16,6 @@ from frappe.email.doctype.email_domain.email_domain import EMAIL_DOMAIN_FIELDS
from frappe.email.receive import EmailServer, InboundMail, SentEmailInInboxError
from frappe.email.smtp import SMTPServer
from frappe.email.utils import get_port
from frappe.integrations.doctype.connected_app.connected_app import check_active_token
from frappe.model.document import Document
from frappe.utils import cint, comma_or, cstr, parse_addr, validate_email_address
from frappe.utils.background_jobs import enqueue, get_jobs

View file

@ -61,7 +61,7 @@ class Oauth:
# where the connect method is called from - hence just logging and raising.
raise
def _connect_pop(self) -> bytes:
def _connect_pop(self) -> None:
# poplib doesn't have AUTH command implementation
res = self._conn._shortcmd(
"AUTH {} {}".format(

View file

@ -117,7 +117,7 @@ class ConnectedApp(Document):
return token_cache
@frappe.whitelist(allow_guest=True)
@frappe.whitelist(methods=["GET"], allow_guest=True)
def callback(code=None, state=None):
"""Handle client's code.
@ -125,8 +125,6 @@ def callback(code=None, state=None):
transmit a code that can be used by the local server to obtain an access
token.
"""
if frappe.request.method != "GET":
frappe.throw(_("Invalid request method: {}").format(frappe.request.method))
if frappe.session.user == "Guest":
frappe.local.response["type"] = "redirect"

View file

@ -6,7 +6,6 @@ Account,Аккаунт,
Accounts Manager,Диспетчер учетных записей,
Accounts User,Пользователь Учетных записей,
Action,Действие,
min read, Действие,
Actions,Действия,
Active,Активен,
Add,Добавить,

1 A4 A4
6 Accounts Manager Диспетчер учетных записей
7 Accounts User Пользователь Учетных записей
8 Action Действие
min read Действие
9 Actions Действия
10 Active Активен
11 Add Добавить

View file

@ -22,7 +22,7 @@
<time datetime="{{ published_on }}">{{ frappe.format_date(published_on) }}</time>
{%- if read_time -%}
&nbsp;&middot;
<span>{{ read_time }} {{ _("min read") }}</span>
<span>{{ read_time }} min read</span>
{%- endif -%}
</div>
</div>