Adds support for SIREN exceptions to validation from the external provider
This commit is contained in:
@ -262,7 +262,8 @@ namespace Yavsc.Controllers
|
||||
if (credential == null)
|
||||
return RedirectToAction("LinkLogin", new { provider = "Google" });
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
ViewBag.Calendars = new GoogleApis.CalendarApi(_googleSettings.ApiKey)
|
||||
.GetCalendars(credential);
|
||||
}
|
||||
@ -485,16 +486,28 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
var user = GetCurrentUserAsync().Result;
|
||||
var uid = user.Id;
|
||||
try {
|
||||
try
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var exSiren = await _dbContext.ExceptionsSIREN.FirstOrDefaultAsync(
|
||||
ex => ex.SIREN == model.SIREN
|
||||
);
|
||||
if (exSiren != null)
|
||||
{
|
||||
_logger.LogInformation("Exception SIREN:"+exSiren);
|
||||
}
|
||||
else
|
||||
{
|
||||
var taskCheck = await _cchecker.CheckAsync(model.SIREN);
|
||||
if (!taskCheck.success) {
|
||||
if (!taskCheck.success)
|
||||
{
|
||||
ModelState.AddModelError(
|
||||
"SIREN",
|
||||
_SR["Invalid company number"] + " (" + taskCheck.errorCode + ")"
|
||||
);
|
||||
_logger.LogWarning("Invalid company number, using key:"+_cinfoSettings.ApiKey);
|
||||
_logger.LogInformation("Invalid company number, using key:" + _cinfoSettings.ApiKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user