Commit ca98ee0d by cam

You can now edit users

parent 1eb5d96c
......@@ -157,7 +157,7 @@ begin
'&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text +
'&Perspective=' + '' +
'&perspective=' + edtPerspective.Text +
'&QB=' + edtQB.Text;
console.log(editOptions);
......@@ -339,12 +339,12 @@ begin
ShowNotification('Passwords must be between 6-20 characters!');
exit;
end;
}
asm
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), {
keyboard: false }{);
keyboard: false });
confirmationModal.show();
end; }
end;
end;
end.
......@@ -242,19 +242,19 @@ function TLookupService.EditUser(const editOptions: string): string;
var
params: TStringList;
user: string;
first_name: string;
last_name: string;
password: string;
full_name: string;
status: string;
email: string;
phone: string;
access: string;
rights: string;
perspective: string;
QB: string;
SQL: string;
Admin: string;
newUser: string;
location: string;
hashString: string;
hashPW: string;
password: string;
active: string;
begin
params := TStringList.Create;
......@@ -263,51 +263,63 @@ begin
params.StrictDelimiter := true;
params.DelimitedText := editOptions;
user := params.Values['username'];
password := params.Values['password'];
full_name := params.Values['fullname'];
phone := params.Values['phonenumber'];
status := params.Values['status'];
email := params.Values['email'];
Admin := params.Values['admin'];
access := params.Values['access'];
rights := params.Values['rights'];
perspective := params.Values['perspective'];
QB := params.Values['QB'];
newUser := params.Values['newuser'];
password := params.Values['password'];
active := params.Values['active'];
location := params.Values['location'];
SQL := 'select * from users where username = ' + QuotedStr(user);
SQL := 'select * from users where USER_NAME = ' + QuotedStr(user);
doQuery(callsDB.UniQuery1, SQL);
if callsDB.UniQuery1.IsEmpty then
Result := 'No such user found'
Result := 'Failure:No such user found'
else
begin
callsDB.UniQuery1.Edit;
//user.password := callsDB.UniQuery1.FieldByName('PASSWORD').AsString;
if (not (newUser.IsEmpty)) then
callsDB.UniQuery1.FieldByName('username').AsString := newUser;
callsDB.UniQuery1.FieldByName('USER_NAME').AsString := newUser;
if (not (full_name.IsEmpty)) then
callsDB.UniQuery1.FieldByName('full_name').AsString := full_name;
callsDB.UniQuery1.FieldByName('NAME').AsString := full_name;
if (not (phone.IsEmpty)) then
callsDB.UniQuery1.FieldByName('phone_number').AsString := phone;
if (not (status.IsEmpty)) then
begin
if( StrToBool(status) ) then
callsDB.UniQuery1.FieldByName('STATUS').AsString := 'ACTIVE'
else
callsDB.UniQuery1.FieldByName('STATUS').AsString := 'INACTIVE'
end;
if (not (email.IsEmpty)) then
callsDB.UniQuery1.FieldByName('email').AsString := email;
callsDB.UniQuery1.FieldByName('EMAIL').AsString := email;
if(not (Admin.IsEmpty)) then
callsDB.UniQuery1.FieldByName('admin').AsBoolean := StrToBool(Admin);
if (not (access.IsEmpty)) then
callsDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access;
if (not (Active.IsEmpty)) then
callsDB.UniQuery1.FieldByName('active').AsBoolean := StrToBool(Active);
if (not (rights.IsEmpty)) then
callsDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights);
if (not (Location.IsEmpty)) then
callsDB.UniQuery1.FieldByName('default_location').asString := location;
if (not (perspective.IsEmpty)) then
callsDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective;
if((not (Password = 'hidden')) and (not (Password.IsEmpty))) then
if (not (access.IsEmpty)) then
callsDB.UniQuery1.FieldByName('QB_ID').AsString := QB;
{if((not (Password = 'hidden')) and (not (Password.IsEmpty))) then
begin
hashString := callsDB.UniQuery1.FieldByName('date_created').AsString + password;
hashPW := THashSHA2.GetHashString(hashString, THashSHA2.TSHA2Version.SHA512).ToUpper;
callsDB.UniQuery1.FieldByName('password').AsString := hashPW;
end;
end;}
callsDB.UniQuery1.Post;
Result := 'Success:Edit Successful';
......
[Options]
LogFileNum=17
LogFileNum=20
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