Commit a063c805 by Mac Stephens

Fixed message if server can't connect to database in login and orders form (if…

Fixed message if server can't connect to database in login and orders form (if they already have a jwt)
parent d24ba5a0
...@@ -21,4 +21,3 @@ kgOrdersServer/Source/__recovery/ ...@@ -21,4 +21,3 @@ kgOrdersServer/Source/__recovery/
*.res *.res
*.skincfg *.skincfg
*.tvsconfig *.tvsconfig
...@@ -100,17 +100,21 @@ end; ...@@ -100,17 +100,21 @@ end;
function TAuthService.Login(const user, password: string): string; function TAuthService.Login(const user, password: string): string;
// Login verification: currently checks if logins are the same or if the user
// is admin, checks for admin password. Eventually will do a database lookup
// instead. If the user has a JWT token they do not need to login.
// Potential error occuring when logging in after you have already logged in
// webcharms.
var var
userState: Integer; userState: Integer;
JWT: TJWT; JWT: TJWT;
begin begin
Logger.Log(1, Format( 'AuthService.Login - User: "%s"', [User])); Logger.Log(1, Format('AuthService.Login - User: "%s"', [User]));
userState := CheckUser( user, password );
try
userState := CheckUser(user, password);
except
on E: Exception do
begin
Logger.Log(1, 'Login failed due to database error: ' + E.Message);
raise EXDataHttpException.Create(500, 'Login failed: Unable to connect to the database.');
end;
end;
if userState = 0 then if userState = 0 then
raise EXDataHttpUnauthorized.Create('Invalid username or password'); raise EXDataHttpUnauthorized.Create('Invalid username or password');
......
[Settings] [Settings]
MemoLogLevel=3 MemoLogLevel=3
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.7 webClientVersion=0.9.8
LogFileNum=927 LogFileNum=941
[Database] [Database]
Server=192.168.159.155 --Server=192.168.159.155
--Server=192.168.102.130 Server=192.168.102.130
--Server=192.168.75.133 --Server=192.168.75.133
Database=kg_order_entry Database=kg_order_entry
Username=root Username=root
......
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