chore: handle get requests via frappe.whitelist decorator
This commit is contained in:
parent
b78f86a307
commit
231d90cb40
5 changed files with 3 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Account,Аккаунт,
|
|||
Accounts Manager,Диспетчер учетных записей,
|
||||
Accounts User,Пользователь Учетных записей,
|
||||
Action,Действие,
|
||||
min read, Действие,
|
||||
Actions,Действия,
|
||||
Active,Активен,
|
||||
Add,Добавить,
|
||||
|
|
|
|||
|
|
|
@ -22,7 +22,7 @@
|
|||
<time datetime="{{ published_on }}">{{ frappe.format_date(published_on) }}</time>
|
||||
{%- if read_time -%}
|
||||
·
|
||||
<span>{{ read_time }} {{ _("min read") }}</span>
|
||||
<span>{{ read_time }} min read</span>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue