Commit 15e7be69 by cam

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

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