Пример #1
0
        public async Task <IActionResult> OnPostResendAsync(string PhoneNumber)
        {
            if (string.IsNullOrWhiteSpace(PhoneNumber))
            {
                return(_MsgBox.ModelStateMsg(_Localizer["PhoneNumberCantBeNull"]));
            }

            var qUser = await _UserApplication.GetUserByPhoneNumberAsync(PhoneNumber);

            if (qUser == null)
            {
                return(_MsgBox.ModelStateMsg(_Localizer["PhoneNumberIsInvalid"]));
            }

            var Result = await _UserApplication.ReCreatePasswordAsync(qUser);

            if (Result.IsSucceeded)
            {
                var IsSend = _SmsSender.SendLoginCode(Input.PhoneNumber, Result.Message);
                if (IsSend)
                {
                    return(_MsgBox.SuccessMsg(_Localizer["LoginCodeIsSent"], "StartTimer()"));
                }
                else
                {
                    return(_MsgBox.FaildMsg(_Localizer["SmsSenderNotRespond"]));
                }
            }
            else
            {
                return(_MsgBox.FaildMsg(_Localizer[Result.Message]));
            }
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(_msgBox.ModelStateMsg(ModelState.GetErrors()));
            }

            var result = await _userApplication.LoginByPhoneNumberStep1Async(Input.PhoneNumber);

            if (result.IsSucceed)
            {
                var isSend = _smsSender.SendLoginCode(Input.PhoneNumber, result.Message);
                if (isSend)
                {
                    return(_msgBox.SuccessMsg(_localizer["LoginCodeIsSent"], "GotoOtpPage()"));
                }
                else
                {
                    return(_msgBox.FaildMsg(_localizer["SmsSenderNotRespond"]));
                }
            }
            else
            {
                return(_msgBox.FaildMsg(_localizer[result.Message]));
            }
        }