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