Skip to content

[Feature] Add option to disable email verification on registration #1517

Open

Description

@taipm

Feature Request: Allow admin to disable email verification requirement

Problem

Currently, Apache Answer always requires email verification after registration. Users cannot access the platform until they click the verification link in their email.

This is problematic because:

  • Many users don't receive or check the verification email
  • It creates friction in user onboarding
  • Some deployments (internal networks, dev environments) don't need email verification

Proposed Solution

Add an admin configuration option to allow users to use the platform immediately after registration without email verification.

Technical Changes Required

1. Schema Changes

File: internal/schema/siteinfo_schema.go

type SiteLoginReq struct {
    AllowNewRegistrations    bool     `json:"allow_new_registrations"`
    AllowEmailRegistrations bool     `json:"allow_email_registrations"`
    AllowPasswordLogin      bool     `json:"allow_password_login"`
    AllowEmailDomains       []string `json:"allow_email_domains"`
    RequireEmailVerification bool    `json:"require_email_verification"` // NEW
}

2. Registration Logic

File: internal/service/content/user_service.go

Current behavior (line ~471):

userInfo.MailStatus = entity.EmailStatusToBeVerified  // Always unverified

New behavior:

if requireEmailVerification {
    userInfo.MailStatus = entity.EmailStatusToBeVerified
} else {
    userInfo.MailStatus = entity.EmailStatusAvailable  // Verified immediately
}

3. Admin API

File: internal/controller_admin/siteinfo_controller.go

  • Update SiteLoginReq struct to include new field
  • Ensure admin can toggle this setting

4. Frontend Admin Panel

File: ui/src/admin/pages/site/ (or similar)

  • Add toggle switch for "Require Email Verification" in login settings

Default Behavior

  • RequireEmailVerification = true (maintain backward compatibility)
  • Admin can set to false to allow immediate access after registration

Database Changes

None required - existing mail_status field already supports both states:

  • 1 = EmailStatusAvailable (verified)
  • 2 = EmailStatusToBeVerified (pending)

Testing Checklist

  • New user registration with verification enabled → mail_status = 2
  • New user registration with verification disabled → mail_status = 1
  • Admin can toggle the setting via admin panel
  • API returns correct value for require_email_verification
  • Existing users with mail_status = 2 still need to verify (if required)

Related Files

  • internal/schema/siteinfo_schema.go
  • internal/service/content/user_service.go
  • internal/controller_admin/siteinfo_controller.go
  • internal/service/siteinfo_common/siteinfo_service.go
  • ui/src/ (admin panel components)

Activity

  1. AsyncAssassin commented on Jun 4, 2026

    @AsyncAssassin
    Contributor

    Hi, I’m preparing a PR for this issue.

    The change will:

    • add a require_email_verification login setting, defaulting to true to preserve the current behavior;
    • expose the setting through the admin login settings API and UI;
    • allow newly registered email users to become active immediately when verification is disabled;
    • keep existing unverified users unchanged;
    • add migration and regression tests for legacy login settings.

    I’ll submit the PR against dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions