Base solution for your next web application

Activities of "jaycee26"

Answer

Thank you! Not sure how I missed that option, but that works as required.

Thanks, J

Question

Version 9.3, Agular .Net Core

I am confused about the user email confirmation/activation process. The terminology used through is (although not completely) is user/email activation. When creating a new user, there is an option to send a activation email. And on the account module, there is a an Email Activation page where a user can put in their email address to have an activation link sent to their email address. Yet the link is to the /account/confirm-email route, not 'activate'.

However, the underlying process is not about 'activation'. A user can be added to a tenant and can log in straight away without 'activating' their account via the received email.

All this 'activation' seems to do is confirm their email address (yet incrorrectly termed as 'activate' IMHO), but it does not prevent access until they have activated their account/email (which is what is meant 'activate' IMHO).

Is the above by design? Is it email confirmation rather than user/email activation? Or am I missunderstanding how this process is designed to work.

I need to have the process that when a user registers or is added to the system they cannot login until they have activated their account via email the email link.

Can you point me in the right direction as to how this can easily be implemented?

Thanks, J

@johntui - OK, sorry it does not work. My solution works with the template 9.3 version using sendgrid.
The only change I made was to enable email sending in debug mode for testing. Other than that, in case it helps here are the SMTP settings I am using;

SMTP host = smtp.sendgrid.net SMTP port = 465 Use SSL = ticked Domain name = sendgrid.net user name = apikey password = my api token from sendgrid account

@johntui you need to be signed in to GitHub in order to see the page, otherwise you get 404 Page Not Found. You also need access to the AspNetZero repository on Github.

But the following was what that commit is, and what I did to get it working;

In aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/AbpZeroTemplateCoreModule.cs

Add ` using MailKit.Net.Smtp; using MailKit.Security;``

And then in the PreIntitialize() Method:

         // MailKit configuration
         Configuration.Modules.AbpMailKit().SecureSocketOption = SecureSocketOptions.Auto;
         Configuration.ReplaceService<IMailKitSmtpBuilder, AbpZeroTemplateMailKitSmtpBuilder>(DependencyLifeStyle.Transient);

`

Then in aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/Net/Emailing/AbpZeroTemplateMailKitSmtpBuilder.cs

`using Abp.MailKit; using Abp.Net.Mail.Smtp; using MailKit.Net.Smtp;

namespace MyCompanyName.AbpZeroTemplate.Net.Emailing { public class AbpZeroTemplateMailKitSmtpBuilder : DefaultMailKitSmtpBuilder { public AbpZeroTemplateMailKitSmtpBuilder( ISmtpEmailSenderConfiguration smtpEmailSenderConfiguration, IAbpMailKitConfiguration abpMailKitConfiguration) : base(smtpEmailSenderConfiguration, abpMailKitConfiguration) {

     }

     protected override void ConfigureClient(SmtpClient client)
     {
         client.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
         base.ConfigureClient(client);
     }
 }

}``

OK, great, it works. Thanks!

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 9.3
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net Core

I have a question as to how languages are handled as part of userMailer.cs, for example:

If I have a user who has set their default language to say es-MX and an admin who has their language set to en-GB triggers an action to send an email to the user, the email is created uses the admin language, not the language as the user. I.e. the email content is sent in English (the default language of the admin), not Spanish (the default language of the user). If the user does not speak English, then they can't understand the content of the email.

It looks like this also applies to the other userMailer functions such as TryToSendSubscriptionExpiringSoonEmail which will send the email in the host default language, not the tenant or recipient user language.

Can you confirm if this is the case and how I might approach being able to change the userMailer.cs to send the email using the language setting for the user/recipient, not the host, tenant or admin default language?

Thanks,

Finally I found the problem! I had not implemented IApplicationService on the interface - schoolboy error :)

Thanks.

@maliming where should I email the zip of the demo project to for you to look at?

OK, that was my oversight, I had not added Abp.AspNetCore dependency, which I have now done and therefore inserting

public override void PostInitialize() { IocManager.Resolve<ApplicationPartManager>() .AddApplicationPartsIfNotAddedBefore(typeof(YourModule).Assembly); }

In CustomServicesModule.cs compiles fine now.

But I still cannot see the module through Swagger.

There is a similar entry in WebCoreModule.cs and that does not display the error.

Showing 1 to 10 of 28 entries