ver 1018: fix login tablet con SOLA pwd/authKey

This commit is contained in:
Samuele E. Locatelli
2018-12-04 23:46:45 +01:00
parent a6819c9533
commit 3b88a6b20f
6 changed files with 102 additions and 48 deletions
+10 -3
View File
@@ -16,9 +16,16 @@
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
scanner.addListener('scan', function (content) {
//console.log(content);
document.getElementById('<%= txtQRCode.ClientID %>').value = content;
document.getElementById('<%= hlReload.ClientID %>').href = content;
document.getElementById('<%= hlReload.ClientID %>').click();
var isUrl = content.includes("http");
if (isUrl) {
// se content è un URL --> faccio reload...
document.getElementById('<%= hlReload.ClientID %>').href = content;
document.getElementById('<%= hlReload.ClientID %>').click();
}
else {
// altrimenti salvo in textBox e processo
document.getElementById('<%= txtQRCode.ClientID %>').value = content;
}
});
Instascan.Camera.getCameras().then(function (cameras) {
if (cameras.length > 0) {
+19 -6
View File
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MapoDb;
using SteamWare;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MoonProTablet.WebUserControls
{
@@ -11,7 +9,7 @@ namespace MoonProTablet.WebUserControls
{
protected void Page_Load(object sender, EventArgs e)
{
// Richeisto https
// Richiesto https
// basato su instascan:
// https://github.com/schmich/instascan
if (!Page.IsPostBack)
@@ -23,6 +21,21 @@ namespace MoonProTablet.WebUserControls
protected void txtQRCode_TextChanged(object sender, EventArgs e)
{
// se abilitato login "pwdOnly" rimando a login...
if (memLayer.ML.cdvb("loginPwdOnly"))
{
string UserAuthKey = txtQRCode.Text.Trim();
// cerco se la pwd valida ci sia...
var results = DataLayer.obj.taOp.getByAuthKey(UserAuthKey);
if (results.Count > 0)
{
// in questo caso rimando a jumper...
int MatrOpr = results[0].MatrOpr;
// rimando a pagina login con pwdOnly...
Response.Redirect(string.Format("jumper?MatrOpr={0}&UserAuthKey={1}", MatrOpr, UserAuthKey));
}
}
//// rimando a pagina di login...
//Response.Redirect(txtQRCode.Text.Trim());
//hlReload.NavigateUrl=txtQRCode.Text.Trim();