Commit 15e7be69 by cam

Add User is now working but User ID needs to be discussed

parent ca98ee0d
...@@ -113,13 +113,16 @@ var ...@@ -113,13 +113,16 @@ var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
responseString: TJSObject; responseString: TJSObject;
begin begin
userInfo := '&username=' + string(edtUsername.Text).ToLower + userInfo := '&username=' + Username +
'&password=' + edtPassword.Text + '&fullname=' + edtFullName.Text +
'&fullname=' + edtFullName.Text + '&password=' + edtPassword.Text +
//'&phonenumber=' + edtPhoneNumber.Text + '&status=' + BoolToStr(cbStatus.Checked) +
'&email=' + edtEmail.Text; '&email=' + edtEmail.Text +
//'&admin=' + BoolToStr(cbAdmin.Checked) + '&access=' + cbAccess.Text +
//'&location=' + wcbLocation.Value; '&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text +
'&perspective=' + edtPerspective.Text +
'&QB=' + edtQB.Text;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser',
[userInfo])); [userInfo]));
......
...@@ -310,7 +310,7 @@ begin ...@@ -310,7 +310,7 @@ begin
if (not (perspective.IsEmpty)) then if (not (perspective.IsEmpty)) then
callsDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective; callsDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective;
if (not (access.IsEmpty)) then if (not (QB.IsEmpty)) then
callsDB.UniQuery1.FieldByName('QB_ID').AsString := QB; callsDB.UniQuery1.FieldByName('QB_ID').AsString := QB;
...@@ -330,9 +330,18 @@ end; ...@@ -330,9 +330,18 @@ end;
function TLookupService.AddUser(userInfo:string): string; function TLookupService.AddUser(userInfo:string): string;
var var
user: string;
password: string;
full_name: string;
status: string;
email: string;
access: string;
rights: string;
perspective: string;
QB: string;
SQL: string;
dateCreated: TDateTime; dateCreated: TDateTime;
hashString: string; hashString: string;
SQL: string;
hashPW: string; hashPW: string;
params: TStringList; params: TStringList;
begin begin
...@@ -342,8 +351,18 @@ begin ...@@ -342,8 +351,18 @@ begin
params.Delimiter := '&'; params.Delimiter := '&';
params.DelimitedText := userInfo; params.DelimitedText := userInfo;
dateCreated := now; dateCreated := now;
hashString := DateTimeToStr(dateCreated) + params.Values['password']; user := params.Values['username'];
hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper; password := params.Values['password'];
full_name := params.Values['fullname'];
status := params.Values['status'];
email := params.Values['email'];
access := params.Values['access'];
rights := params.Values['rights'];
perspective := params.Values['perspective'];
QB := params.Values['QB'];
//newUser := params.Values['newuser'];
//hashString := DateTimeToStr(dateCreated) + params.Values['password'];
//hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
SQL := 'select * from users where username = ' + QuotedStr(params.Values['username'].toLower); SQL := 'select * from users where username = ' + QuotedStr(params.Values['username'].toLower);
callsDB.UniQuery1.Close; callsDB.UniQuery1.Close;
callsDB.UniQuery1.SQL.Text := SQL; callsDB.UniQuery1.SQL.Text := SQL;
...@@ -352,14 +371,23 @@ begin ...@@ -352,14 +371,23 @@ begin
begin begin
callsDB.UniQuery1.Insert; callsDB.UniQuery1.Insert;
callsDB.UniQuery1.FieldByName('username').AsString := params.Values['username'].toLower; callsDB.UniQuery1.FieldByName('USER_NAME').AsString := user;
callsDB.UniQuery1.FieldByName('password').AsString := THashSHA2.GetHashString(hashString, callsDB.UniQuery1.FieldByName('PASSWORD').AsString := password;
THashSHA2.TSHA2Version.SHA512).ToUpper; //THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
callsDB.UniQuery1.FieldByName('date_created').AsString := DateTimeToStr(dateCreated); //callsDB.UniQuery1.FieldByName('date_created').AsString := DateTimeToStr(dateCreated);
callsDB.UniQuery1.FieldByName('full_name').AsString := params.Values['fullname']; callsDB.UniQuery1.FieldByName('NAME').AsString := full_name;
callsDB.UniQuery1.FieldByName('phone_number').AsString := params.Values['phonenumber'];
callsDB.UniQuery1.FieldByName('email').AsString := params.Values['email']; if( StrToBool(status) ) then
callsDB.UniQuery1.FieldByName('admin').AsBoolean := StrToBool(params.Values['admin']); callsDB.UniQuery1.FieldByName('STATUS').AsString := 'ACTIVE'
else
callsDB.UniQuery1.FieldByName('STATUS').AsString := 'INACTIVE';
callsDB.UniQuery1.FieldByName('EMAIL').AsString := email;
callsDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access;
callsDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights);
callsDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective;
callsDB.UniQuery1.FieldByName('QB_ID').AsString := QB;
callsDB.UniQuery1.Post; callsDB.UniQuery1.Post;
Result := 'Success:User successfully added'; Result := 'Success:User successfully added';
end end
......
[Options] [Options]
LogFileNum=20 LogFileNum=21
UpdateTimerLength=0 UpdateTimerLength=0
......
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