Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: make mail account password and refresh token text fields (#8107)

shamoon159344f03391
diff --git a/src/documents/tests/test_migration_workflows.py b/src/documents/tests/test_migration_workflows.py
index 9a911d2e5..69f5ed5fb 100644
--- a/src/documents/tests/test_migration_workflows.py
+++ b/src/documents/tests/test_migration_workflows.py
@@ -8,7 +8,7 @@ class TestMigrateWorkflow(TestMigrations):
dependencies = (
(
"paperless_mail",
- "0027_mailaccount_expiration_mailaccount_account_type_and_more",
+ "0028_alter_mailaccount_password_and_more",
),
)
diff --git a/src/paperless_mail/migrations/0028_alter_mailaccount_password_and_more.py b/src/paperless_mail/migrations/0028_alter_mailaccount_password_and_more.py
new file mode 100644
index 000000000..2a0279651
--- /dev/null
+++ b/src/paperless_mail/migrations/0028_alter_mailaccount_password_and_more.py
@@ -0,0 +1,31 @@
+# Generated by Django 5.1.1 on 2024-10-30 04:31
+
+from django.db import migrations
+from django.db import models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ (
+ "paperless_mail",
+ "0027_mailaccount_expiration_mailaccount_account_type_and_more",
+ ),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="mailaccount",
+ name="password",
+ field=models.TextField(verbose_name="password"),
+ ),
+ migrations.AlterField(
+ model_name="mailaccount",
+ name="refresh_token",
+ field=models.TextField(
+ blank=True,
+ help_text="The refresh token to use for token authentication e.g. with oauth2.",
+ null=True,
+ verbose_name="refresh token",
+ ),
+ ),
+ ]
diff --git a/src/paperless_mail/models.py b/src/paperless_mail/models.py
index 6ba00151d..46b9db1ff 100644
--- a/src/paperless_mail/models.py
+++ b/src/paperless_mail/models.py
@@ -42,7 +42,7 @@ class MailAccount(document_models.ModelWithOwner):
username = models.CharField(_("username"), max_length=256)
- password = models.CharField(_("password"), max_length=3072)
+ password = models.TextField(_("password"))
is_token = models.BooleanField(_("Is token authentication"), default=False)
@@ -62,9 +62,8 @@ class MailAccount(document_models.ModelWithOwner):
default=MailAccountType.IMAP,
)
- refresh_token = models.CharField(
+ refresh_token = models.TextField(
_("refresh token"),
- max_length=3072,
blank=True,
null=True,
help_text=_(