Commit ca98ee0d by cam

You can now edit users

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