msg
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Service">
|
||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
||||
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -142,15 +142,15 @@ namespace Back.Controllers
|
||||
|
||||
await _servPermission.AddPermissionUser(roluser.ID, allper.Select(s => s.ID).ToArray());
|
||||
|
||||
var ID = await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
var modelvc = await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
{
|
||||
prm = company.ID.ToString(),
|
||||
val = user.ID.ToString(),
|
||||
Type = "CompanyRegistration"
|
||||
});
|
||||
|
||||
_servSendMsg.Authentication(company.Mobile, ID.ToString());
|
||||
return Ok(ID);
|
||||
_servSendMsg.toContinue(modelvc.Code.ToString(), company.Mobile, "ثبت نام");
|
||||
return Ok(modelvc.ID);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -176,15 +176,15 @@ namespace Back.Controllers
|
||||
if (!resultValidationmodel.IsValid)
|
||||
return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList());
|
||||
|
||||
var ID = await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
var modelvc = await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
{
|
||||
prm = Item.Username,
|
||||
val = Item.PassWord,
|
||||
Type = "ForgetPassword"
|
||||
});
|
||||
|
||||
_servSendMsg.Authentication(Item.Username, ID.ToString());
|
||||
return Ok(ID);
|
||||
_servSendMsg.toContinue(modelvc.Code.ToString(),Item.Username, "فراموشی کلمه عبور");
|
||||
return Ok(modelvc.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -123,14 +123,14 @@ namespace Back.Controllers
|
||||
item.CompanyID = pid.Value.ToString();
|
||||
var Ticket = await _servTicket.NewTicket(item, StatusTicket.unknownPerson);
|
||||
|
||||
var ID = await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
var modelvc = await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
{
|
||||
prm = Ticket.ID.ToString(),
|
||||
val = item.Mobile,
|
||||
Type = "NewTicketNoAuthentication"
|
||||
});
|
||||
_servSendMsg.Authentication(item.Mobile, ID.ToString());
|
||||
return Ticket == null ? BadRequest() : Ok(ID);
|
||||
_servSendMsg.toContinue(modelvc.Code.ToString(),item.Mobile, "ثبت نظر");
|
||||
return Ticket == null ? BadRequest() : Ok(modelvc.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -69,15 +69,15 @@ namespace Back.Controllers
|
||||
|
||||
var UserID = HttpContext.User.Claims.First(c => c.Type == "UserID").Value;
|
||||
|
||||
var ID = await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
var modelvc = await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
{
|
||||
prm = UserID,
|
||||
val = newUsername,
|
||||
Type = "ChangeUserName"
|
||||
});
|
||||
|
||||
_servSendMsg.Authentication(newUsername, ID.ToString());
|
||||
return Ok(ID);
|
||||
_servSendMsg.toContinue(modelvc.Code.ToString(),newUsername, "تغییر نام کاربری");
|
||||
return Ok(modelvc.ID);
|
||||
|
||||
// return Ok(await _servUser.ChangeUserName(newUsername, Convert.ToInt32(UserID)));
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ namespace Back.Controllers
|
||||
_servUser = servUser;
|
||||
}
|
||||
[HttpGet("GetVerification/{ID}")]
|
||||
[AllowAnonymous]
|
||||
|
||||
public async Task<ActionResult<VerificationCode>> GetVerification(int ID)
|
||||
{
|
||||
var resultValidationmodel = await _getVerificationValidation.ValidateAsync(ID);
|
||||
@@ -44,7 +44,7 @@ namespace Back.Controllers
|
||||
});;
|
||||
}
|
||||
[HttpGet("ReSend/{ID}")]
|
||||
[AllowAnonymous]
|
||||
|
||||
public async Task<ActionResult> ReSend(int ID)
|
||||
{
|
||||
var resultValidationmodel = await _getVerificationValidation.ValidateAsync(ID);
|
||||
@@ -55,23 +55,23 @@ namespace Back.Controllers
|
||||
switch (_getVerificationValidation.verificationCode.Type)
|
||||
{
|
||||
case "NewTicketNoAuthentication":
|
||||
_servSendMsg.Authentication(_getVerificationValidation.verificationCode.val, ID.ToString());
|
||||
_servSendMsg.toContinue(_getVerificationValidation.verificationCode.Code.ToString(), _getVerificationValidation.verificationCode.val,"ثبت نظر");
|
||||
break;
|
||||
|
||||
case "CompanyRegistration":
|
||||
var company=await _servCompany.GetCompanyOrg(Convert.ToInt32(_getVerificationValidation.verificationCode.prm),false);
|
||||
_servSendMsg.Authentication(company.Mobile, ID.ToString());
|
||||
_servSendMsg.toContinue(_getVerificationValidation.verificationCode.Code.ToString(),company.Mobile, "ثبت نام");
|
||||
break;
|
||||
|
||||
|
||||
case "ForgetPassword":
|
||||
var user = await _servUser.ChangePasswordByMobile(_getVerificationValidation.verificationCode.prm, _getVerificationValidation.verificationCode.val);
|
||||
_servSendMsg.Authentication(_getVerificationValidation.verificationCode.prm, ID.ToString());
|
||||
// var user = await _servUser.ChangePasswordByMobile(_getVerificationValidation.verificationCode.prm, _getVerificationValidation.verificationCode.val);
|
||||
_servSendMsg.toContinue(_getVerificationValidation.verificationCode.Code.ToString(), _getVerificationValidation.verificationCode.prm, "فراموشی کلمه عبور");
|
||||
break;
|
||||
|
||||
|
||||
case "ChangeUserName":
|
||||
_servSendMsg.Authentication(_getVerificationValidation.verificationCode.val, ID.ToString());
|
||||
_servSendMsg.toContinue(_getVerificationValidation.verificationCode.Code.ToString(), _getVerificationValidation.verificationCode.val, "تغییر نام کاربری");
|
||||
break;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Back.Controllers
|
||||
return NoContent();
|
||||
}
|
||||
[HttpPost("Submit")]
|
||||
[AllowAnonymous]
|
||||
|
||||
public async Task<ActionResult<bool>> Submit(VerificationCodeDto item)
|
||||
{
|
||||
var VerificationCode= await _servValidatinMsg.GetVerificationCodeByID(item.ID);
|
||||
@@ -107,6 +107,11 @@ namespace Back.Controllers
|
||||
//else return BadRequest();
|
||||
break;
|
||||
|
||||
case "ForgetPassword":
|
||||
Sucstatus = await _servUser.ChangePasswordByMobile(VerificationCode.prm, VerificationCode.val);
|
||||
|
||||
break;
|
||||
|
||||
case "ChangeUserName":
|
||||
Sucstatus = await _servUser.ChangeUserName(VerificationCode.val, Convert.ToInt32(VerificationCode.prm));
|
||||
break;
|
||||
@@ -127,7 +132,7 @@ namespace Back.Controllers
|
||||
|
||||
}
|
||||
[HttpDelete("Remove/{ID}")]
|
||||
[AllowAnonymous]
|
||||
|
||||
public async Task<ActionResult<bool>> Remove(int ID)
|
||||
{
|
||||
var VerificationCode = await _servValidatinMsg.GetVerificationCodeByID(ID);
|
||||
|
@@ -61,7 +61,7 @@ namespace Back.Services
|
||||
company.IsActive = true;
|
||||
if (await _CompanyRepo.UpdateAsync(company))
|
||||
{
|
||||
_servSendMsg.SuccessfulRegistration(user.Mobile, $"{user.Mobile};{user.Mobile}");
|
||||
_servSendMsg.SuccessfulRegistration(user.Mobile, user.Mobile,user.Mobile);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Back.Services
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public async Task<int> GenerateCode(VerificationCode code)
|
||||
public async Task<VerificationCode> GenerateCode(VerificationCode code)
|
||||
{
|
||||
code.Code = Random.Shared.Next(1000, 9000);
|
||||
while (await GetVerificationCode(code.Code) != null)
|
||||
@@ -77,8 +77,8 @@ namespace Back.Services
|
||||
|
||||
|
||||
var indb= await _verificationCodeRepo.AddAsync(code);
|
||||
|
||||
return indb.ID;
|
||||
code.ID = indb.ID;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,11 +4,22 @@
|
||||
{
|
||||
private readonly mpNuget.RestClient _restClient;
|
||||
public servSendMsg(mpNuget.RestClient restClient)=> _restClient = restClient;
|
||||
private void SendMsgByPatern(string Text, string To, int bodyID) {/*_restClient.SendByBaseNumber(Text, To, bodyID);*/ }
|
||||
//private void SendMsgByPatern(string Text, string To, int bodyID) {/*_restClient.SendByBaseNumber(Text, To, bodyID);*/ }
|
||||
private void SendMsg(string Text, string To)=> _restClient.Send(To, "50004001660045", Text, false);
|
||||
public void Authentication(string to,string code) => SendMsgByPatern(code, to, 0);
|
||||
public void SuccessfulRegistration(string to, string code) => SendMsgByPatern(code, to, 1);
|
||||
public void SuccessfulPayment(string to, string code) => SendMsgByPatern(code, to, 2);
|
||||
// public void firstEntry(string to, string code) => SendMsgByPatern(code, to, 3);
|
||||
public void toContinue(string Code, string To,string title)
|
||||
{
|
||||
SendMsg($"برای ادامه {title} از کد {Code} استفاده کنید",To);
|
||||
}
|
||||
public void SuccessfulRegistration(string to, string Username, string Password)
|
||||
{
|
||||
SendMsg("ثبت نام شما با موفقیت انجام شد" + '\n' +
|
||||
"اطلاعات کاربری:" + '\n' +
|
||||
$"نام کاربری : {Username}" +
|
||||
$"کلمه عبور : {Password}" ,to);
|
||||
}
|
||||
//public void Authentication(string to,string code) => SendMsgByPatern(code, to, 0);
|
||||
//
|
||||
//public void SuccessfulPayment(string to, string code) => SendMsgByPatern(code, to, 2);
|
||||
// public void firstEntry(string to, string code) => SendMsgByPatern(code, to, 3);
|
||||
}
|
||||
}
|
||||
|
@@ -104,7 +104,8 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="postbox__forget text-end">
|
||||
<a onclick="@ForgetPass">رمز عبور را فراموش کرده اید؟</a>
|
||||
<Button Color="ButtonColor.Link" @onclick="ForgetPass">رمز عبور را فراموش کرده اید؟</Button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -34,9 +34,9 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
||||
}) ;
|
||||
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||
|
||||
|
@@ -33,6 +33,7 @@ namespace Front.Services
|
||||
_user.enterDate = userinfomodel.enterDate;
|
||||
_user.UserName= userinfomodel.UserName;
|
||||
}
|
||||
else { _httpClient.DefaultRequestHeaders.Clear(); }
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user