Affinata SIM prima aprte
This commit is contained in:
@@ -193,7 +193,10 @@ namespace MConnectSDK
|
||||
userAuthData answ = new userAuthData();
|
||||
// init altro
|
||||
requestStatus reqSt = preCheckStatus();
|
||||
tokResp = new tokenResponse();
|
||||
if (tokResp == null)
|
||||
{
|
||||
tokResp = new tokenResponse();
|
||||
}
|
||||
// verifico autorizzazione... se non c'è TENTO auth...
|
||||
if (!reqSt.isHmiEnrolled)
|
||||
{
|
||||
@@ -203,14 +206,28 @@ namespace MConnectSDK
|
||||
// verifico chiamata server...
|
||||
if (_currParam.testMode)
|
||||
{
|
||||
Random r = new Random();
|
||||
int user_code = 0;
|
||||
// verifico SE CI SIA in redis il valore dell'user_code ed uso quello, altrimenti genero e lascio su redis...
|
||||
if (redServAlive)
|
||||
{
|
||||
var szUserCode = ML.getRSV(ML.redHash("SIM:USER_CODE"));
|
||||
int.TryParse(szUserCode, out user_code);
|
||||
}
|
||||
// se non trovato...
|
||||
if (user_code <= 0)
|
||||
{
|
||||
Random r = new Random();
|
||||
user_code = r.Next(1, 999999);
|
||||
// salvo!!!
|
||||
ML.setRSV(ML.redHash("SIM:USER_CODE"), user_code.ToString(), 5);
|
||||
}
|
||||
|
||||
tokResp = new tokenResponse()
|
||||
{
|
||||
device_code = "TEST-DEV",
|
||||
user_code = string.Format("{0:000000}", r.Next(1, 999999)),
|
||||
user_code = string.Format("{0:000000}", user_code),
|
||||
verification_uri = "localhost:3000/client-auth/verification",
|
||||
interval = 1000,
|
||||
interval = 100,
|
||||
expires_in = 60000
|
||||
};
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace TestClient
|
||||
}
|
||||
else
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -217,8 +217,9 @@ namespace TestClient
|
||||
private void updateAuthData(userAuthData authData)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("--------------------------------------------------");
|
||||
sb.AppendLine(string.Format("user_code: {0}", authData.userCode));
|
||||
//sb.AppendLine("--------------------------------------------------");
|
||||
sb.AppendLine("user_code:");
|
||||
sb.AppendLine(authData.userCode.ToString());
|
||||
sb.AppendLine("");
|
||||
lblRetData.Text = sb.ToString();
|
||||
// mostro QR-code
|
||||
|
||||
Reference in New Issue
Block a user