mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-26 01:12:43 -05:00
Feature: OAuth2 Gmail and Outlook email support (#7866)
This commit is contained in:
@@ -15,6 +15,11 @@ class MailAccount(document_models.ModelWithOwner):
|
||||
SSL = 2, _("Use SSL")
|
||||
STARTTLS = 3, _("Use STARTTLS")
|
||||
|
||||
class MailAccountType(models.IntegerChoices):
|
||||
IMAP = 1, _("IMAP")
|
||||
GMAIL_OAUTH = 2, _("Gmail OAuth")
|
||||
OUTLOOK_OAUTH = 3, _("Outlook OAuth")
|
||||
|
||||
name = models.CharField(_("name"), max_length=256, unique=True)
|
||||
|
||||
imap_server = models.CharField(_("IMAP server"), max_length=256)
|
||||
@@ -51,6 +56,31 @@ class MailAccount(document_models.ModelWithOwner):
|
||||
),
|
||||
)
|
||||
|
||||
account_type = models.PositiveIntegerField(
|
||||
_("account type"),
|
||||
choices=MailAccountType.choices,
|
||||
default=MailAccountType.IMAP,
|
||||
)
|
||||
|
||||
refresh_token = models.CharField(
|
||||
_("refresh token"),
|
||||
max_length=2048,
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text=_(
|
||||
"The refresh token to use for token authentication e.g. with oauth2.",
|
||||
),
|
||||
)
|
||||
|
||||
expiration = models.DateTimeField(
|
||||
_("expiration"),
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text=_(
|
||||
"The expiration date of the refresh token. ",
|
||||
),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
Reference in New Issue
Block a user