diff --git a/Back/Back.csproj b/Back/Back.csproj
index fd97cd7..899d7e4 100644
--- a/Back/Back.csproj
+++ b/Back/Back.csproj
@@ -36,7 +36,7 @@
- ..\..\Dlls\Service.dll
+ ..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll
diff --git a/Back/Controllers/BaseController.cs b/Back/Controllers/BaseController.cs
index a3fcff2..605e4e7 100644
--- a/Back/Controllers/BaseController.cs
+++ b/Back/Controllers/BaseController.cs
@@ -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);
}
}
}
diff --git a/Back/Controllers/TicketController.cs b/Back/Controllers/TicketController.cs
index e89eb05..6c7bd40 100644
--- a/Back/Controllers/TicketController.cs
+++ b/Back/Controllers/TicketController.cs
@@ -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);
}
}
}
diff --git a/Back/Controllers/UserController.cs b/Back/Controllers/UserController.cs
index b4954d5..75069a9 100644
--- a/Back/Controllers/UserController.cs
+++ b/Back/Controllers/UserController.cs
@@ -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)));
}
diff --git a/Back/Controllers/VerificationController.cs b/Back/Controllers/VerificationController.cs
index da8635f..55cb71f 100644
--- a/Back/Controllers/VerificationController.cs
+++ b/Back/Controllers/VerificationController.cs
@@ -28,7 +28,7 @@ namespace Back.Controllers
_servUser = servUser;
}
[HttpGet("GetVerification/{ID}")]
- [AllowAnonymous]
+
public async Task> GetVerification(int ID)
{
var resultValidationmodel = await _getVerificationValidation.ValidateAsync(ID);
@@ -44,7 +44,7 @@ namespace Back.Controllers
});;
}
[HttpGet("ReSend/{ID}")]
- [AllowAnonymous]
+
public async Task 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> 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> Remove(int ID)
{
var VerificationCode = await _servValidatinMsg.GetVerificationCodeByID(ID);
diff --git a/Back/Services/ServValidatinMsg.cs b/Back/Services/ServValidatinMsg.cs
index 29e8578..190614e 100644
--- a/Back/Services/ServValidatinMsg.cs
+++ b/Back/Services/ServValidatinMsg.cs
@@ -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 GenerateCode(VerificationCode code)
+ public async Task 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;
}
}
}
diff --git a/Back/Services/servSendMsg.cs b/Back/Services/servSendMsg.cs
index 202c546..b7f06f6 100644
--- a/Back/Services/servSendMsg.cs
+++ b/Back/Services/servSendMsg.cs
@@ -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);
}
}
diff --git a/TaxPayerFull/Pages/Sign-in.razor b/TaxPayerFull/Pages/Sign-in.razor
index 893a389..91393fe 100644
--- a/TaxPayerFull/Pages/Sign-in.razor
+++ b/TaxPayerFull/Pages/Sign-in.razor
@@ -104,7 +104,8 @@
diff --git a/TaxPayerFull/Program.cs b/TaxPayerFull/Program.cs
index 628e6c3..f8805c2 100644
--- a/TaxPayerFull/Program.cs
+++ b/TaxPayerFull/Program.cs
@@ -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");
diff --git a/TaxPayerFull/Services/MidLevel.cs b/TaxPayerFull/Services/MidLevel.cs
index 44fbc6f..2703b5e 100644
--- a/TaxPayerFull/Services/MidLevel.cs
+++ b/TaxPayerFull/Services/MidLevel.cs
@@ -33,6 +33,7 @@ namespace Front.Services
_user.enterDate = userinfomodel.enterDate;
_user.UserName= userinfomodel.UserName;
}
+ else { _httpClient.DefaultRequestHeaders.Clear(); }
}
}