Open Closed

Forgot password &Confirmation e-mail issue for sub domain and seperated auth server #7517


User avatar
0
n.uerkmez created
  • ABP Framework version: v8.2.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue: Hi,

I can send e-mails using Mailkit via host API and application.

But here is the problem, the I forgot my password function from the separated authserver interface gives the following error.

Even though I installed Mailkit and related packages in the AuthServer project, the Account module still uses SmtpClient instead of Malkit.

The following code snippet has been added to the ...AuthServerModule.cs file. The application is a multitenant app and uses a sub-domain.

However, the ABP Account module or ABP Background job executer ignores to use Mailkit

Configure<AbpMailKitOptions>(options =>


7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try to add the code below to all your backend projects?

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.Replace(ServiceDescriptor.Transient<IEmailSender, MailKitSmtpEmailSender>());
    }
    
  • User Avatar
    0
    n.uerkmez created

    Great. That works. But another issue came out. We are using the subdomain approach for tenants like https://{0}.authserver.domain.local:44319/Account/ResetPassword

    Since the reset link has been sent without "subdomain1" as https://authserver.domain.local:44319/Account/ResetPassword from authserver even though I made request via https://subdomain1.authserver.domain.local:44319/Account/ForgotPassword

    The reset link must include subdomain1 as follows. https://{subdomain1}.authserver.domain.local:44319/Account/ForgotPassword

    However, every email is being sent via a host link.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    What is the value of your options.Applications["MVC"].RootUrl, This is the key url.

  • User Avatar
    0
    n.uerkmez created

    options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; "SelfUrl": "https://authserver.domain.local:44319",

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Try "SelfUrl": "https://{0}.authserver.domain.local:44319", or "SelfUrl": "https://{{tenantName}}.authserver.domain.local:44319",

  • User Avatar
    0
    n.uerkmez created

    Thanks. Great, That worked.

    Let me try it on Azure. If there is no issue I will close the ticket

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15