Commit fceb378c by Mac Stephens

Update to login xdata connection error

parent 6ee6efe1
...@@ -4,7 +4,7 @@ interface ...@@ -4,7 +4,7 @@ interface
uses uses
System.SysUtils, System.Classes, WEBLib.Modules, XData.Web.Connection, System.SysUtils, System.Classes, WEBLib.Modules, XData.Web.Connection,
App.Types, App.Config, XData.Web.Client, WEBLib.Dialogs; App.Types, App.Config, XData.Web.Client, WEBLib.Dialogs, Utils;
type type
TDMConnection = class(TWebDataModule) TDMConnection = class(TWebDataModule)
...@@ -73,8 +73,8 @@ var ...@@ -73,8 +73,8 @@ var
errorMsg: string; errorMsg: string;
begin begin
errorMsg := Error.ErrorMessage; errorMsg := Error.ErrorMessage;
if errorMsg = '' then if errorMsg = 'Error connecting to XData server' then
errorMsg := 'Connection error'; errorMsg := 'Error connecting to server. Please try again later.';
if Assigned(FUnauthorizedAccessProc) then if Assigned(FUnauthorizedAccessProc) then
FUnauthorizedAccessProc(errorMsg) FUnauthorizedAccessProc(errorMsg)
......
...@@ -6,8 +6,7 @@ uses ...@@ -6,8 +6,7 @@ uses
System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.Dialogs, System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.JSON, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.JSON,
XData.Web.Client, WEBLib.ExtCtrls, Vcl.Imaging.pngimage, XData.Web.Client, WEBLib.ExtCtrls, Vcl.Imaging.pngimage,
JS, XData.Web.Connection, JS, XData.Web.Connection, App.Types, ConnectionModule;
App.Types, ConnectionModule;
type type
TFViewLogin = class(TWebForm) TFViewLogin = class(TWebForm)
...@@ -55,14 +54,21 @@ procedure TFViewLogin.btnLoginClick(Sender: TObject); ...@@ -55,14 +54,21 @@ procedure TFViewLogin.btnLoginClick(Sender: TObject);
begin begin
ShowNotification('Login Error: ' + AMsg); ShowNotification('Login Error: ' + AMsg);
end; end;
var
hashPW: string; procedure AuthConnectionOpened;
begin
AuthService.Login(
edtUsername.Text, edtPassword.Text, DMConnection.clientVersion,
@LoginSuccess,
@LoginError
);
end;
begin begin
AuthService.Login( if not DMConnection.AuthConnection.Connected then
edtUsername.Text, edtPassword.Text, DMConnection.clientVersion, DMConnection.AuthConnection.Open(@AuthConnectionOpened)
@LoginSuccess, else
@LoginError AuthConnectionOpened;
);
end; end;
class procedure TFViewLogin.Display(LoginProc: TSuccessProc); class procedure TFViewLogin.Display(LoginProc: TSuccessProc);
......
[Settings] [Settings]
MemoLogLevel=5 MemoLogLevel=5
FileLogLevel=5 FileLogLevel=5
LogFileNum=40 LogFileNum=44
DevMode=0 DevMode=0
webClientVersion=0.0.1 webClientVersion=0.0.1
......
...@@ -130,15 +130,12 @@ begin ...@@ -130,15 +130,12 @@ begin
raise EXDataHttpUnauthorized.Create('Invalid username or password'); raise EXDataHttpUnauthorized.Create('Invalid username or password');
end; end;
// ADD THIS DELETE BEFORE DEPLOY
passwordHash := password.ToUpper; passwordHash := password.ToUpper;
storedHash := AuthDb.uqUser.FieldByName('user_password').AsString.ToUpper; storedHash := AuthDb.uqUser.FieldByName('user_password').AsString.ToUpper;
// STOP HERE DELETE BEFORE DEPLOY
// REMOVE THIS DELETE BEFORE DEPLOY
// passwordHash := THashSHA2.GetHashString(username + password, THashSHA2.TSHA2Version.SHA256).ToUpper; // passwordHash := THashSHA2.GetHashString(username + password, THashSHA2.TSHA2Version.SHA256).ToUpper;
// storedHash := AuthDb.uqUser.FieldByName('user_password').AsString.ToUpper; // storedHash := AuthDb.uqUser.FieldByName('user_password').AsString.ToUpper;
// STOP HERE DELETE BEFORE DEPLOY
if storedHash <> passwordHash then if storedHash <> passwordHash then
begin begin
......
...@@ -8,13 +8,11 @@ uses ...@@ -8,13 +8,11 @@ uses
type type
TIniEntries = class TIniEntries = class
private private
// [Settings]
FConsoleLogLevel: Integer; FConsoleLogLevel: Integer;
FFileLogLevel: Integer; FFileLogLevel: Integer;
FLogFileNum: Integer; FLogFileNum: Integer;
FJWTSecret: string; FJWTSecret: string;
// [Database]
FDBServer: string; FDBServer: string;
FDBPort: Integer; FDBPort: Integer;
FDBDatabase: string; FDBDatabase: string;
...@@ -24,7 +22,6 @@ type ...@@ -24,7 +22,6 @@ type
public public
constructor Create; constructor Create;
// Properties
property consoleLogLevel: Integer read FConsoleLogLevel; property consoleLogLevel: Integer read FConsoleLogLevel;
property fileLogLevel: Integer read FFileLogLevel; property fileLogLevel: Integer read FFileLogLevel;
property logFileNum: Integer read FLogFileNum; property logFileNum: Integer read FLogFileNum;
...@@ -59,12 +56,10 @@ var ...@@ -59,12 +56,10 @@ var
begin begin
iniFile := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini')); iniFile := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
try try
// [Settings]
FConsoleLogLevel := iniFile.ReadInteger('Settings', 'ConsoleLogLevel', 3); FConsoleLogLevel := iniFile.ReadInteger('Settings', 'ConsoleLogLevel', 3);
FFileLogLevel := iniFile.ReadInteger('Settings', 'FileLogLevel', 3); FFileLogLevel := iniFile.ReadInteger('Settings', 'FileLogLevel', 3);
FLogFileNum := iniFile.ReadInteger('Settings', 'LogFileNum', 0); FLogFileNum := iniFile.ReadInteger('Settings', 'LogFileNum', 0);
// [Database]
FDBServer := iniFile.ReadString('Database', 'Server', '192.168.116.129'); FDBServer := iniFile.ReadString('Database', 'Server', '192.168.116.129');
FDBPort := iniFile.ReadInteger('Database', 'Port', 0); FDBPort := iniFile.ReadInteger('Database', 'Port', 0);
FDBDatabase := iniFile.ReadString('Database', 'Database', 'kg_order_entry'); FDBDatabase := iniFile.ReadString('Database', 'Database', 'kg_order_entry');
......
...@@ -831,6 +831,9 @@ ...@@ -831,6 +831,9 @@
<Platform Name="Win64x"> <Platform Name="Win64x">
<Operation>1</Operation> <Operation>1</Operation>
</Platform> </Platform>
<Platform Name="WinARM64EC">
<Operation>1</Operation>
</Platform>
</DeployClass> </DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug"> <DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32"> <Platform Name="iOSDevice32">
...@@ -901,6 +904,10 @@ ...@@ -901,6 +904,10 @@
<RemoteDir>Assets</RemoteDir> <RemoteDir>Assets</RemoteDir>
<Operation>1</Operation> <Operation>1</Operation>
</Platform> </Platform>
<Platform Name="WinARM64EC">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass> </DeployClass>
<DeployClass Name="UWP_DelphiLogo44"> <DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32"> <Platform Name="Win32">
...@@ -911,6 +918,10 @@ ...@@ -911,6 +918,10 @@
<RemoteDir>Assets</RemoteDir> <RemoteDir>Assets</RemoteDir>
<Operation>1</Operation> <Operation>1</Operation>
</Platform> </Platform>
<Platform Name="WinARM64EC">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass> </DeployClass>
<DeployClass Name="iOS_AppStore1024"> <DeployClass Name="iOS_AppStore1024">
<Platform Name="iOSDevice64"> <Platform Name="iOSDevice64">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment