Ends in:
2 DAYS
11 HRS
27 MIN
49 SEC
Ends in:
2 D
11 H
27 M
49 S
Open Closed

Entering invalid phone number locks you out of the system #4469


User avatar
0
ageiter created

If the user enters an invalid phone number in the profile under "Personal info" and does not confirm it there, he will not be able to login the next time. Reason for this: The phone number has to be verified, but this is not possible with a wrong number and the text field for this is readonly.

Hint: The settings "Require confirmed phone number" and "Allow users to confirm their phone number" are activated. Very likely there is the same problem with the mail address.

By the way, very useful would be the validation of the phone number (e.g. whether the country code was specified). Otherwise, when using the Twilio module, you run into an exception with an invalid formatting.

Since this is a bug, I wish my number questions would not be charged (that's why I posted it on GitHub first).


4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I will check it.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Yes, it's a problem. we will fix it in the next version.

    You can try put the Default.js file in your Pages\Account\Components\ProfileManagementGroup\\PersonalInfo path.

    Default.js

    (function ($) {
    
        $(function () {
            var l = abp.localization.getResource("AbpAccount");
    
            var _profileService = volo.abp.account.profile;
            var _accountService = volo.abp.account.account;
    
            var _confirmPhoneNumberModal = new abp.ModalManager(
                abp.appPath + "Account/Components/ProfileManagementGroup/PersonalInfo/ConfirmPhoneNumberModal"
            );
    
            var $email = $('#PersonalSettingsForm').find("#Email");
            var $verifyEmail = $("#VerifyEmailButton");
            var $emailVerified = $("#EmailVerified");
            var $emailNotVerified = $("#EmailNotVerified");
    
            var $phone = $('#PersonalSettingsForm').find("#PhoneNumber");
            var $verifyPhone = $("#VerifyPhoneButton");
            var $phoneVerified = $("#PhoneVerified");
            var $phoneNotVerified = $("#PhoneNotVerified");
    
    
            $('#PersonalSettingsForm').find("#Email").keyup(function () {
                if ($(this).val() !== $(this).attr("data-saved-email")) {
                    $("#VerifyEmailButton").hide();
                    $("#EmailVerified").hide();
                    $("#EmailNotVerified").show();
                } else if ($(this).attr("data-email-verified") === "False") {
                    $("#VerifyEmailButton").show();
                    $("#EmailNotVerified").hide();
                } else if ($(this).attr("data-email-verified") === "True") {
                    $("#EmailVerified").show();
                    $("#EmailNotVerified").hide();
                }
            });
    
            $('#PersonalSettingsForm').find("#PhoneNumber").keyup(function () {
                if ($(this).val() !== $(this).attr("data-saved-phone")) {
                    $("#VerifyPhoneButton").hide();
                    $("#PhoneVerified").hide();
    
                    if ($(this).val() !== "") {
                        $("#PhoneNotVerified").show();
                    } else {
                        $("#PhoneNotVerified").hide();
                    }
                } else if ($(this).attr("data-phone-verified") === "False") {
                    if ($(this).val() !== "") {
                        $("#VerifyPhoneButton").show();
                    }
                    $("#PhoneNotVerified").hide();
                } else if ($(this).attr("data-phone-verified") === "True") {
                    if ($(this).val() !== "") {
                        $("#PhoneVerified").show();
                    }
                    $("#PhoneNotVerified").hide();
                }
            });
    
            $("#VerifyEmailButton").on("click", "", function () {
    
                var returnUrl = "/";
                var returnUrlLink = $("#returnUrlLink");
    
                if(returnUrlLink.length === 1){
                    returnUrl = returnUrlLink.attr("href");
                }
    
                _accountService
                    .sendEmailConfirmationToken({
                        userId: $('#CurrentUserId').val(),
                        appName: "MVC",
                        returnUrl:returnUrl,
                        returnUrlHash: "",
                    })
                    .then(function () {
                        abp.notify.success(
                            l(
                                "EmailConfirmationSentMessage",
                                $('#PersonalSettingsForm').find("#Email").val()
                            )
                        );
                        $("#VerifyEmailButton").hide();
                    });
            });
    
            $("#VerifyPhoneButton").on("click", "", function () {
                _confirmPhoneNumberModal.open();
            });
    
            var askForVerify = function () {
                abp.message.confirm(
                    " ",
                    l("DoYouWantToVerifyPhoneNumberMessage"),
                    function (isConfirmed) {
                        if (isConfirmed) {
                            $("#VerifyPhoneButton").click();
                        }
                    }
                );
            };
    
            $("#PersonalSettingsForm").submit(function (e) {
                e.preventDefault();
    
                if (!$("#PersonalSettingsForm").valid()) {
                    return false;
                }
    
                var input = $("#PersonalSettingsForm").serializeFormToObject(false);
    
                _profileService.update(input).then(function (result) {
                    abp.notify.success(l("PersonalSettingsSaved"));
    
                    if (input.Email !== $email.attr("data-saved-email")) {
                        $verifyEmail.show();
                        $emailVerified.hide();
                        $email.attr("data-email-verified", "False");
                    }
    
                    $email.attr("data-saved-email", $email.val());
                    $emailNotVerified.hide();
    
                    if (!input.PhoneNumber || input.PhoneNumber === "") {
                        $verifyPhone.hide();
                        $phoneVerified.hide();
                        $phoneNotVerified.hide();
                        $phone.attr("data-saved-phone", input.PhoneNumber);
                        return;
                    }
    
                    if (
                        $phone.attr("data-saved-phone") === input.PhoneNumber ||
                        $verifyPhone.length < 1
                    ) {
                        return;
                    }
    
                    $verifyPhone.show();
                    $phoneVerified.hide();
                    $phoneNotVerified.hide();
                    $phone.attr("data-saved-phone", input.PhoneNumber);
                    $phone.attr("data-phone-verified", "False");
    
                    askForVerify();
                });
            });
    
            _confirmPhoneNumberModal.onResult(function () {
                $verifyPhone.hide();
                $phoneNotVerified.hide();
                $phoneVerified.show();
                $phone.attr("data-phone-verified", "True");
            });
        });
    })(jQuery);
    
    

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    You can remove the file when the next patch(7.0.2) version is released.

  • User Avatar
    0
    ageiter created

    Thanks @liangshiwei.

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