Skip to content

Commit

Permalink
Fix login for username/password #108
Browse files Browse the repository at this point in the history
  • Loading branch information
rstrouse committed Jul 20, 2023
1 parent 120f6be commit 7f4cc19
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ConfigSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef configsettings_h
#define configsettings_h

#define FW_VERSION "v2.0.2"
#define FW_VERSION "v2.0.3"
enum DeviceStatus {
DS_OK = 0,
DS_ERROR = 1,
Expand Down
Binary file modified SomfyController.ino.esp32.bin
Binary file not shown.
Binary file modified SomfyController.littlefs.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion data/appversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.2
2.0.3
10 changes: 5 additions & 5 deletions data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet" href="main.css?v=2.0.2" type="text/css" />
<link rel="stylesheet" href="widgets.css?v=2.0.2" type="text/css" />
<link rel="stylesheet" href="icons.css?v=2.0.2" type="text/css" />
<link rel="stylesheet" href="main.css?v=2.0.3" type="text/css" />
<link rel="stylesheet" href="widgets.css?v=2.0.3" type="text/css" />
<link rel="stylesheet" href="icons.css?v=2.0.3" type="text/css" />
<link rel="icon" type="image/png" href="favicon.png" />
<script type="text/javascript" src="index.js?v=2.0.2"></script>
<script type="text/javascript" src="index.js?v=2.0.3"></script>
</head>
<body>
<div id="divContainer" class="container main" data-auth="false">
Expand Down Expand Up @@ -584,7 +584,7 @@ <h1 style="text-align: center;"><img src="icon.png" style="width:50px;float:left
<div id="divUnauthenticated">
<h1 style="text-align: center;"><img src="icon.png" style="width:127px;margin-left:1px;margin-top:-10px;" /></h1>
<input id="fldLoginPin" type="hidden" name="pin" />
<input id="fldLoginType" type="hidden" data-bind="type" data-datatype="int" />
<input id="fldLoginType" type="hidden" data-bind="login.type" data-datatype="int" />
<div id="divLoginPin" style="display:none;">
<div class="field-group" style="text-align:center;">
<div id="fldPinEntry" style="display:inline-block;" onkeydown="ui.pinKeyPressed(event);">
Expand Down
18 changes: 13 additions & 5 deletions data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,8 @@ class Security {
resolve();
if (err) ui.serviceError(err);
else {
console.log(ctx);
document.getElementById('divContainer').setAttribute('data-securitytype', ctx.type);
this.type = ctx.type;
this.permissions = ctx.permissions;
switch (ctx.type) {
Expand Down Expand Up @@ -1153,13 +1155,19 @@ class Security {
let msg = pnl.querySelector('#spanLoginMessage');
msg.innerHTML = '';
let sec = ui.fromElement(pnl).login;
console.log(sec);
let pin = '';
for (let i = 0; i < 4; i++) {
pin += sec.pin[`d${i}`];
switch (sec.type) {
case 1:
for (let i = 0; i < 4; i++) {
pin += sec.pin[`d${i}`];
}
if (pin.length !== 4) return;
break;
case 2:
break;
}
if (pin.length !== 4) return;
sec.pin = pin;
console.log(sec);
putJSONSync('/login', sec, (err, log) => {
if (err) ui.serviceError(err);
else {
Expand All @@ -1186,7 +1194,7 @@ var security = new Security();

class General {
initialized = false;
appVersion = 'v2.0.2';
appVersion = 'v2.0.3';
reloadApp = false;
init() {
if (this.initialized) return;
Expand Down

0 comments on commit 7f4cc19

Please sign in to comment.