Open Closed

Phone verification is not working #2842


User avatar
0
safi created

Hi

Phone verification is not working so I explored and installed twilio settings in appsettings.json file but got success message like code sent to a phone number but not getting verification code. Please help me.

  • ABP Framework version: v4.4.3
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

35 Answer(s)
  • User Avatar
    0
    safi created

    please reply

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    HI,

    Can you share the full steps?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    The document: https://docs.abp.io/en/commercial/latest/modules/twilio-sms

    Please make sure the module dependency is added

    [DependsOn(
        //......
        typeof(AbpTwilioSmsModule)
        )]
    public class YourModule : AbpModule
    {
    }
    
  • User Avatar
    0
    safi created

    The document: https://docs.abp.io/en/commercial/latest/modules/twilio-sms

    Please make sure the module dependency is added

    [DependsOn( 
        //...... 
        typeof(AbpTwilioSmsModule) 
        )] 
    public class YourModule : AbpModule 
    { 
    } 
    

    do I need to install this too

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    do I need to install this too

    No, you don't need, the Twilio module depends on SMS.

  • User Avatar
    0
    safi created

    Hi,

    do I need to install this too

    No, you don't need, the Twilio module depends on SMS.

    Thanks much. It's working. Can you please check this one https://support.abp.io/QA/Questions/2810/Menu-is-not-hiding-while-checking-permission-on-menucontributor-class

  • User Avatar
    0
    safi created

    Hi

    I created an account on twillio but it's sending SMS on a registered mobile number only. so can we use the amazon service for this? If yes then how we can do this.

    I am expecting a reply fast because it's very urgent for us.

    Thanks,

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Do you mean using Amazon SMS service https://docs.aws.amazon.com/sns/latest/dg/sns-mobile-phone-number-as-subscriber.html?

    Actually, you can use any SMS service you want.

    For example:

    [Dependency(ReplaceServices = true)]
    public class AmazonSmsSender : ISmsSender, ITransientDependency
    {
        
        public virtual async Task SendAsync(SmsMessage smsMessage)
        {
            //Using amazon SMS service to send a message
        }
    }
    
  • User Avatar
    0
    safi created

    Hi,

    Do you mean using Amazon SMS service https://docs.aws.amazon.com/sns/latest/dg/sns-mobile-phone-number-as-subscriber.html?

    Actually, you can use any SMS service you want.

    For example:

    [Dependency(ReplaceServices = true)] 
    public class AmazonSmsSender : ISmsSender, ITransientDependency 
    { 
         
        public virtual async Task SendAsync(SmsMessage smsMessage) 
        { 
            //Using amazon SMS service to send a message 
        } 
    } 
    

    ok thanks. Where we need to create this Amazonsmssender and where we need to call this. Please let me know.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    you can put the class in the domain project,

    where we need to call this

    I didn't get it, can you explain it in detail? when you need to send a message you can inject an ISmsSender interface to use it.

  • User Avatar
    0
    safi created

    Hi,

    you can put the class in the domain project,

    where we need to call this

    I didn't get it, can you explain it in detail? when you need to send a message you can inject an ISmsSender interface to use it.

    I mean do we need to call this Amazonsmssender in anywhere in a project to run this or directly it will work.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can create a new project named YourProjectName.Sms.Amazon, just like: https://github.com/abpframework/abp/tree/dev/framework/src/Volo.Abp.Sms.Aliyun

    And you can use it anywhere via project reference.

  • User Avatar
    0
    safi created

    Hi,

    You can create a new project named YourProjectName.Sms.Amazon, just like: https://github.com/abpframework/abp/tree/dev/framework/src/Volo.Abp.Sms.Aliyun

    And you can use it anywhere via project reference.

    Ok but as you mentioned above u can add this in domain project so If I add this in domain then it will work right?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Ok but as you mentioned above u can add this in domain project

    Because I don't know what kind of project are you using and you want use it anywhere.

    If I add this in domain then it will work right?

    If you are building a microservice solution, probably not, because every service has a domain project. If you are building a monolithic solution, it will work.

    Creating a new project is a better way, you can use it in any project.

  • User Avatar
    0
    safi created

    Hi,

    Ok but as you mentioned above u can add this in domain project

    Because I don't know what kind of project are you using and you want use it anywhere.

    If I add this in domain then it will work right?

    If you are building a microservice solution, probably not, because every service has a domain project. If you are building a monolithic solution, it will work.

    Creating a new project is a better way, you can use it in any project.

    I am using ABP io with blazor and the version is 4.4.3

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can just put the class in the domain project it should work.

  • User Avatar
    0
    safi created

    Hi

    If I want to remove this phone number field then what I need to do please let me know

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can't remove it, it's a part of ASP.NET Core Identity, but you can hide it.

  • User Avatar
    0
    safi created

    Hi,

    You can't remove it, it's a part of ASP.NET Core Identity, but you can hide it.

    How can I do this

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    See the document: https://docs.abp.io/en/abp/latest/UI/Blazor/Customization-Overriding-Components

    For example: https://gist.github.com/realLiangshiwei/7b206990452bf566c711c0a0472d043d

  • User Avatar
    0
    safi created

    See the document: https://docs.abp.io/en/abp/latest/UI/Blazor/Customization-Overriding-Components

    For example: https://gist.github.com/realLiangshiwei/7b206990452bf566c711c0a0472d043d

    It's throwing a error because I have customized user page as well.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    because I have customized user page as well.

    You can continue to use your custom page and delete phone number related code

  • User Avatar
    0
    safi created

    ok so I am just adding this line in last. protected override async ValueTask SetTableColumnsAsync() { await base.SetTableColumnsAsync();

        UserManagementTableColumns.RemoveAll(x => x.Title.Contains("Phone"));
    }
    
  • User Avatar
    0
    safi created

    ok so I am just adding this line in last. protected override async ValueTask SetTableColumnsAsync() { await base.SetTableColumnsAsync();

        UserManagementTableColumns.RemoveAll(x => x.Title.Contains("Phone")); 
    } 
    

    I need to hide this field in manage your profile section as well so it will work?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    No, it only works for the user management page.

    The profile page is MVC UI, you can hide the phone number input via Javascript.

    global.js

    $(function(){
        if($("#ProfileManagementTab").length === 1){
            $("#ProfileManagementTab #PhoneNumber").parent().hide()
            $("#ProfileManagementTab #PhoneNumber").parent().prev().hide()
        }
    })
    
    Configure<AbpBundlingOptions>(options =>
    {   
        options.ScriptBundles.Configure(
            LeptonThemeBundles.Styles.Global,
            bundle =>
            {
                bundle.AddFiles("/global.js");
            }
        )
    });
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15