Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
emiMobile
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mac Stephens
emiMobile
Commits
0d785cfb
Commit
0d785cfb
authored
Nov 23, 2026
by
Mac Stephens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add automatic login selector on login form
parent
f68da2f3
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
107 additions
and
3 deletions
+107
-3
Auth.Service.pas
Client/BFD/Source/Auth.Service.pas
+17
-0
View.Login.dfm
Client/BFD/Source/View.Login.dfm
+8
-0
View.Login.html
Client/BFD/Source/View.Login.html
+4
-0
View.Login.pas
Client/BFD/Source/View.Login.pas
+6
-0
bfdEmiMobile.dpr
Client/BFD/bfdEmiMobile.dpr
+18
-1
Auth.Service.pas
Client/WCSO/Source/Auth.Service.pas
+17
-0
View.Login.dfm
Client/WCSO/Source/View.Login.dfm
+8
-0
View.Login.html
Client/WCSO/Source/View.Login.html
+4
-0
View.Login.pas
Client/WCSO/Source/View.Login.pas
+6
-0
WCSOemiMobile.dpr
Client/WCSO/WCSOemiMobile.dpr
+18
-1
BFDemiMobileServer.ini
Server/bin/BFD/BFDemiMobileServer.ini
+1
-1
No files found.
Client/BFD/Source/Auth.Service.pas
View file @
0d785cfb
...
@@ -38,6 +38,8 @@ type
...
@@ -38,6 +38,8 @@ type
// JWT helpers
// JWT helpers
procedure
Logout
;
procedure
Logout
;
function
AutoLoginEnabled
:
Boolean
;
procedure
SetAutoLoginEnabled
(
Value
:
Boolean
);
function
GetToken
:
string
;
function
GetToken
:
string
;
function
Authenticated
:
Boolean
;
function
Authenticated
:
Boolean
;
function
TokenExpirationDate
:
TDateTime
;
function
TokenExpirationDate
:
TDateTime
;
...
@@ -180,6 +182,21 @@ end;
...
@@ -180,6 +182,21 @@ end;
procedure
TAuthService
.
Logout
;
procedure
TAuthService
.
Logout
;
begin
begin
DeleteToken
;
DeleteToken
;
if
not
DeviceManagementMode
then
SetAutoLoginEnabled
(
False
);
end
;
function
TAuthService
.
AutoLoginEnabled
:
Boolean
;
begin
Result
:=
window
.
localStorage
.
getItem
(
CREDENTIAL_NAME
+
'_AUTO_LOGIN'
)
=
'true'
;
end
;
procedure
TAuthService
.
SetAutoLoginEnabled
(
Value
:
Boolean
);
begin
if
Value
then
window
.
localStorage
.
setItem
(
CREDENTIAL_NAME
+
'_AUTO_LOGIN'
,
'true'
)
else
window
.
localStorage
.
removeItem
(
CREDENTIAL_NAME
+
'_AUTO_LOGIN'
);
end
;
end
;
// ---- Credential ID storage ----
// ---- Credential ID storage ----
...
...
Client/BFD/Source/View.Login.dfm
View file @
0d785cfb
...
@@ -53,6 +53,14 @@ object FViewLogin: TFViewLogin
...
@@ -53,6 +53,14 @@ object FViewLogin: TFViewLogin
WidthPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnShowPasswordClick
OnClick = btnShowPasswordClick
end
end
object chkAutoLogin: TWebCheckBox
Left = 240
Top = 250
Width = 200
Height = 22
Caption = 'Sign me in automatically'
ElementID = 'view.login.autologin'
end
object btnLogin: TWebButton
object btnLogin: TWebButton
Left = 240
Left = 240
Top = 217
Top = 217
...
...
Client/BFD/Source/View.Login.html
View file @
0d785cfb
...
@@ -67,6 +67,10 @@
...
@@ -67,6 +67,10 @@
<!-- populated dynamically -->
<!-- populated dynamically -->
</select>
</select>
</div>
</div>
<div
id=
"view.login.autologinsection"
class=
"form-check mb-3 d-none"
>
<input
id=
"view.login.autologin"
class=
"form-check-input fs-6"
type=
"checkbox"
>
<label
class=
"form-check-label"
for=
"view.login.autologin"
>
Sign me in automatically
</label>
</div>
<button
id=
"view.login.btnlogin"
<button
id=
"view.login.btnlogin"
class=
"btn btn-primary w-100"
>
class=
"btn btn-primary w-100"
>
Login
Login
...
...
Client/BFD/Source/View.Login.pas
View file @
0d785cfb
...
@@ -15,6 +15,7 @@ type
...
@@ -15,6 +15,7 @@ type
edtPassword
:
TWebEdit
;
edtPassword
:
TWebEdit
;
btnShowPassword
:
TWebButton
;
btnShowPassword
:
TWebButton
;
btnLogin
:
TWebButton
;
btnLogin
:
TWebButton
;
chkAutoLogin
:
TWebCheckBox
;
btnPasskeyLogin
:
TWebButton
;
btnPasskeyLogin
:
TWebButton
;
pnlMessage
:
TWebPanel
;
pnlMessage
:
TWebPanel
;
lblMessage
:
TWebLabel
;
lblMessage
:
TWebLabel
;
...
@@ -110,6 +111,9 @@ var
...
@@ -110,6 +111,9 @@ var
end
;
end
;
begin
begin
chkAutoLogin
.
Checked
:=
AuthService
.
AutoLoginEnabled
;
if
AuthService
.
IsSimpleKey
and
not
AuthService
.
DeviceManagementMode
then
Document
.
getElementById
(
'view.login.autologinsection'
).
classList
.
remove
(
'd-none'
);
GetAgencyConfigList
;
GetAgencyConfigList
;
el
:=
Document
.
getElementById
(
'view.login.version'
);
el
:=
Document
.
getElementById
(
'view.login.version'
);
if
Assigned
(
el
)
then
if
Assigned
(
el
)
then
...
@@ -149,6 +153,8 @@ var
...
@@ -149,6 +153,8 @@ var
procedure
OnLoginOK
;
procedure
OnLoginOK
;
begin
begin
if
AuthService
.
IsSimpleKey
and
not
AuthService
.
DeviceManagementMode
then
AuthService
.
SetAutoLoginEnabled
(
chkAutoLogin
.
Checked
);
FLoginProc
;
FLoginProc
;
end
;
end
;
...
...
Client/BFD/bfdEmiMobile.dpr
View file @
0d785cfb
...
@@ -88,6 +88,18 @@ begin
...
@@ -88,6 +88,18 @@ begin
end;
end;
procedure StartApplication;
procedure StartApplication;
procedure OnAutoLoginFailed(AMessage: string);
begin
DisplayLoginView(AMessage);
end;
procedure OnChallenge(AChallenge, AChallengeToken: string);
begin
AuthService.LoginDeviceKey(AuthService.GetCredentialId, AChallengeToken,
@DisplayMainView, @OnAutoLoginFailed);
end;
begin
begin
if AuthService.DeviceManagementMode then
if AuthService.DeviceManagementMode then
begin
begin
...
@@ -104,7 +116,12 @@ begin
...
@@ -104,7 +116,12 @@ begin
// Step 2: normal JWT auth check
// Step 2: normal JWT auth check
if (not AuthService.Authenticated) or AuthService.TokenExpired then
if (not AuthService.Authenticated) or AuthService.TokenExpired then
DisplayLoginView
begin
if AuthService.IsSimpleKey and AuthService.AutoLoginEnabled then
AuthService.BeginAuthentication(AuthService.GetCredentialId, @OnChallenge, @OnAutoLoginFailed)
else
DisplayLoginView;
end
else
else
DisplayMainView;
DisplayMainView;
end;
end;
...
...
Client/WCSO/Source/Auth.Service.pas
View file @
0d785cfb
...
@@ -38,6 +38,8 @@ type
...
@@ -38,6 +38,8 @@ type
// JWT helpers
// JWT helpers
procedure
Logout
;
procedure
Logout
;
function
AutoLoginEnabled
:
Boolean
;
procedure
SetAutoLoginEnabled
(
Value
:
Boolean
);
function
GetToken
:
string
;
function
GetToken
:
string
;
function
Authenticated
:
Boolean
;
function
Authenticated
:
Boolean
;
function
TokenExpirationDate
:
TDateTime
;
function
TokenExpirationDate
:
TDateTime
;
...
@@ -208,6 +210,21 @@ end;
...
@@ -208,6 +210,21 @@ end;
procedure
TAuthService
.
Logout
;
procedure
TAuthService
.
Logout
;
begin
begin
DeleteToken
;
DeleteToken
;
if
not
DeviceManagementMode
then
SetAutoLoginEnabled
(
False
);
end
;
function
TAuthService
.
AutoLoginEnabled
:
Boolean
;
begin
Result
:=
window
.
localStorage
.
getItem
(
CREDENTIAL_NAME
+
'_AUTO_LOGIN'
)
=
'true'
;
end
;
procedure
TAuthService
.
SetAutoLoginEnabled
(
Value
:
Boolean
);
begin
if
Value
then
window
.
localStorage
.
setItem
(
CREDENTIAL_NAME
+
'_AUTO_LOGIN'
,
'true'
)
else
window
.
localStorage
.
removeItem
(
CREDENTIAL_NAME
+
'_AUTO_LOGIN'
);
end
;
end
;
// ---- Credential ID storage ----
// ---- Credential ID storage ----
...
...
Client/WCSO/Source/View.Login.dfm
View file @
0d785cfb
...
@@ -53,6 +53,14 @@ object FViewLogin: TFViewLogin
...
@@ -53,6 +53,14 @@ object FViewLogin: TFViewLogin
WidthPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnShowPasswordClick
OnClick = btnShowPasswordClick
end
end
object chkAutoLogin: TWebCheckBox
Left = 240
Top = 250
Width = 200
Height = 22
Caption = 'Sign me in automatically'
ElementID = 'view.login.autologin'
end
object btnLogin: TWebButton
object btnLogin: TWebButton
Left = 240
Left = 240
Top = 217
Top = 217
...
...
Client/WCSO/Source/View.Login.html
View file @
0d785cfb
...
@@ -67,6 +67,10 @@
...
@@ -67,6 +67,10 @@
<!-- populated dynamically -->
<!-- populated dynamically -->
</select>
</select>
</div>
</div>
<div
id=
"view.login.autologinsection"
class=
"form-check mb-3 d-none"
>
<input
id=
"view.login.autologin"
class=
"form-check-input fs-6"
type=
"checkbox"
>
<label
class=
"form-check-label"
for=
"view.login.autologin"
>
Sign me in automatically
</label>
</div>
<button
id=
"view.login.btnlogin"
<button
id=
"view.login.btnlogin"
class=
"btn btn-primary w-100"
>
class=
"btn btn-primary w-100"
>
Login
Login
...
...
Client/WCSO/Source/View.Login.pas
View file @
0d785cfb
...
@@ -15,6 +15,7 @@ type
...
@@ -15,6 +15,7 @@ type
edtPassword
:
TWebEdit
;
edtPassword
:
TWebEdit
;
btnShowPassword
:
TWebButton
;
btnShowPassword
:
TWebButton
;
btnLogin
:
TWebButton
;
btnLogin
:
TWebButton
;
chkAutoLogin
:
TWebCheckBox
;
btnPasskeyLogin
:
TWebButton
;
btnPasskeyLogin
:
TWebButton
;
pnlMessage
:
TWebPanel
;
pnlMessage
:
TWebPanel
;
lblMessage
:
TWebLabel
;
lblMessage
:
TWebLabel
;
...
@@ -110,6 +111,9 @@ var
...
@@ -110,6 +111,9 @@ var
end
;
end
;
begin
begin
chkAutoLogin
.
Checked
:=
AuthService
.
AutoLoginEnabled
;
if
AuthService
.
IsSimpleKey
and
not
AuthService
.
DeviceManagementMode
then
Document
.
getElementById
(
'view.login.autologinsection'
).
classList
.
remove
(
'd-none'
);
GetAgencyConfigList
;
GetAgencyConfigList
;
el
:=
Document
.
getElementById
(
'view.login.version'
);
el
:=
Document
.
getElementById
(
'view.login.version'
);
if
Assigned
(
el
)
then
if
Assigned
(
el
)
then
...
@@ -149,6 +153,8 @@ var
...
@@ -149,6 +153,8 @@ var
procedure
OnLoginOK
;
procedure
OnLoginOK
;
begin
begin
if
AuthService
.
IsSimpleKey
and
not
AuthService
.
DeviceManagementMode
then
AuthService
.
SetAutoLoginEnabled
(
chkAutoLogin
.
Checked
);
FLoginProc
;
FLoginProc
;
end
;
end
;
...
...
Client/WCSO/WCSOemiMobile.dpr
View file @
0d785cfb
...
@@ -88,6 +88,18 @@ begin
...
@@ -88,6 +88,18 @@ begin
end;
end;
procedure StartApplication;
procedure StartApplication;
procedure OnAutoLoginFailed(AMessage: string);
begin
DisplayLoginView(AMessage);
end;
procedure OnChallenge(AChallenge, AChallengeToken: string);
begin
AuthService.LoginDeviceKey(AuthService.GetCredentialId, AChallengeToken,
@DisplayMainView, @OnAutoLoginFailed);
end;
begin
begin
if AuthService.DeviceManagementMode then
if AuthService.DeviceManagementMode then
begin
begin
...
@@ -104,7 +116,12 @@ begin
...
@@ -104,7 +116,12 @@ begin
// Step 2: normal JWT auth check
// Step 2: normal JWT auth check
if (not AuthService.Authenticated) or AuthService.TokenExpired then
if (not AuthService.Authenticated) or AuthService.TokenExpired then
DisplayLoginView
begin
if AuthService.IsSimpleKey and AuthService.AutoLoginEnabled then
AuthService.BeginAuthentication(AuthService.GetCredentialId, @OnChallenge, @OnAutoLoginFailed)
else
DisplayLoginView;
end
else
else
DisplayMainView;
DisplayMainView;
end;
end;
...
...
Server/bin/BFD/BFDemiMobileServer.ini
View file @
0d785cfb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
Agency
=
BFD
Agency
=
BFD
[Settings]
[Settings]
LogFileNum
=
21
4
LogFileNum
=
21
6
webClientVersion
=
0.9.5.0
webClientVersion
=
0.9.5.0
MemoLogLevel
=
3
MemoLogLevel
=
3
FileLogLevel
=
4
FileLogLevel
=
4
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment