-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathockpasswordquery.pas
73 lines (58 loc) · 1.5 KB
/
ockpasswordquery.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
unit OckPasswordQuery;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
{$IFDEF LINUX}
{add Linux specific units here}
OckLinux,
{$ENDIF LINUX}
{$IFDEF DARWIN}
{add MacOS specific units here}
OckMacOS,
{$ENDIF DARWIN}
OckImagesToDepot;
type
{ TFormPasswordQuery }
TFormPasswordQuery = class(TForm)
ButtonCancel: TButton;
ButtonOK: TButton;
EditPassword: TLabeledEdit;
LabelDescription: TLabel;
SudoOrRoot: TRadioGroup;
procedure ButtonCancelClick(Sender: TObject);
procedure ButtonOKClick(Sender: TObject);
private
public
//RunCommandElevated : TRunCommandElevated;
end;
var
FormPasswordQuery: TFormPasswordQuery;
implementation
{$R *.lfm}
{ TFormPasswordQuery }
procedure TFormPasswordQuery.ButtonOKClick(Sender: TObject);
var
S:string;
begin
If SudoOrRoot.Items[SudoOrRoot.ItemIndex] = 'root' then
RunCommandElevated.Sudo := False
else if SudoOrRoot.Items[SudoOrRoot.ItemIndex] = 'sudo' then
RunCommandElevated.Sudo := True;
S := EditPassword.Text;
//Insert('',S,pos('',S)); //AnsiQuotedStr(EditPassword.Text,'''');
RunCommandElevated.Password := S;
S := '';
if PasswordCorrect then
begin
Close;
FormSaveImagesOnDepot.Visible := True;
end
else
ShowMessage('Wrong Password');
end;
procedure TFormPasswordQuery.ButtonCancelClick(Sender: TObject);
begin
Close;
end;
end.