You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
4.8 KiB
Plaintext
174 lines
4.8 KiB
Plaintext
{
|
|
This file is part of R&Q.
|
|
Under same license
|
|
}
|
|
{$I RnQConfig.inc}
|
|
unit security_fr;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
|
|
StdCtrls, RnQButtons, RDGlobal, RnQPrefsLib, ExtCtrls;
|
|
|
|
{$I NoRTTI.inc}
|
|
|
|
type
|
|
TsecurityFr = class(TPrefFrame)
|
|
histcryptEnableChk: TCheckBox;
|
|
cryptGroup: TGroupBox;
|
|
histcryptSavePwdChk: TCheckBox;
|
|
dontsavepwdChk: TCheckBox;
|
|
writeHistoryChk: TCheckBox;
|
|
DelHistChk: TCheckBox;
|
|
MakeBakChk: TCheckBox;
|
|
AddTempVisMsgChk: TCheckBox;
|
|
histcryptChangeBtn: TRnQButton;
|
|
CplPwdChk: TCheckBox;
|
|
AskPassOnBossChk: TCheckBox;
|
|
SetAccPassBtn: TRnQButton;
|
|
HistCryptBtn: TRnQButton;
|
|
procedure histcryptEnableChkClick(Sender: TObject);
|
|
procedure histcryptChangeBtnClick(Sender: TObject);
|
|
procedure dontsavepwdChkClick(Sender: TObject);
|
|
procedure SetAccPassBtnClick(Sender: TObject);
|
|
procedure HistCryptBtnClick(Sender: TObject);
|
|
protected
|
|
newHistPwd: String;
|
|
// newAccPass : AnsiString;
|
|
public
|
|
// procedure initProps;
|
|
procedure applyPage; Override;
|
|
procedure resetPage; Override;
|
|
procedure updateVisPage; Override;
|
|
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
utilLib, RnQLangs, RQUtil, RnQDialogs, langLib, RnQGlobal,
|
|
changepwddlg, globalLib,
|
|
{$IFDEF DB_ENABLED}
|
|
RnQDB,
|
|
{$ENDIF DB_ENABLED}
|
|
history,
|
|
ICQv9;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure TsecurityFr.histcryptEnableChkClick(Sender: TObject);
|
|
begin
|
|
with histcryptEnableChk do
|
|
if checked and not histcrypt.enabled then
|
|
if messageDlg(getTranslation('You are invited to NOT use this function for now. It''s still under test.\nContinue?'),
|
|
mtWarning, [mbYes, mbNo], 0) = mrNo then
|
|
begin
|
|
checked := FALSE;
|
|
exit;
|
|
end;
|
|
updateVisPage
|
|
end;
|
|
|
|
procedure TsecurityFr.dontsavepwdChkClick(Sender: TObject);
|
|
begin
|
|
updateVisPage
|
|
end;
|
|
|
|
procedure TsecurityFr.histcryptChangeBtnClick(Sender: TObject);
|
|
begin
|
|
enterPwdDlg(newHistPwd)
|
|
end;
|
|
|
|
procedure TsecurityFr.applyPage;
|
|
begin
|
|
logpref.writehistory := writeHistoryChk.checked;
|
|
dontSavePwd := dontsavepwdChk.checked;
|
|
clearPwdOnDSNCT := CplPwdChk.checked and dontsavepwdChk.checked;
|
|
askPassOnBossKeyOn := AskPassOnBossChk.checked;
|
|
MakeBakups := MakeBakChk.checked;
|
|
addTempVisMsg := AddTempVisMsgChk.checked;
|
|
histcrypt.savePwd := histcryptSavePwdChk.checked;
|
|
|
|
with histcrypt do
|
|
if histcryptEnableChk.checked and (newHistPwd = '') then
|
|
msgDlg('You did not entered any password, so encryption will be disabled!', True, mtError)
|
|
else
|
|
{$IFDEF RNQ_FULL2}
|
|
if (pwd <> newHistPwd) or (enabled <> histcryptEnableChk.checked) then
|
|
begin
|
|
if (pwd = '') and enabled then
|
|
begin
|
|
msgDlg('You have to enter the old password!', True, mtWarning);
|
|
enterPwdDlg(pwd);
|
|
end;
|
|
if messageDlg
|
|
(getTranslation
|
|
('You asked to change history encryption.\nR&&Q must convert all histories and it can be lengthy. Proceed?'),
|
|
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
|
|
if histcryptEnableChk.checked then
|
|
convertHistoriesDlg(pwd, newHistPwd)
|
|
else
|
|
convertHistoriesDlg(pwd, '');
|
|
end;
|
|
{$ENDIF}
|
|
// if newAccPass <> '' then
|
|
// AccPass := newAccPass;
|
|
// newAccPass := '';
|
|
// saveCfgDelayed := True;
|
|
end;
|
|
|
|
procedure TsecurityFr.resetPage;
|
|
begin
|
|
writeHistoryChk.checked := logpref.writehistory;
|
|
dontsavepwdChk.checked := dontSavePwd;
|
|
CplPwdChk.checked := clearPwdOnDSNCT;
|
|
AskPassOnBossChk.checked := askPassOnBossKeyOn;
|
|
MakeBakChk.checked := MakeBakups;
|
|
AddTempVisMsgChk.checked := addTempVisMsg;
|
|
histcryptEnableChk.checked := histcrypt.enabled;
|
|
histcryptSavePwdChk.checked := histcrypt.savePwd;
|
|
newHistPwd := histcrypt.pwd;
|
|
// newAccPass := '';
|
|
end;
|
|
|
|
procedure TsecurityFr.SetAccPassBtnClick(Sender: TObject);
|
|
begin
|
|
// enterPwdDlg(newAccPass, getTranslation('Account password'), 16);
|
|
if not Assigned(changeAccPwdFrm) then
|
|
begin
|
|
changeAccPwdFrm := TchangePwdFrm.Create(NIL, True);
|
|
changeAccPwdFrm.Caption := 'Change account password';
|
|
translateWindow(changeAccPwdFrm);
|
|
end;
|
|
changeAccPwdFrm.showModal
|
|
end;
|
|
|
|
procedure TsecurityFr.HistCryptBtnClick(Sender: TObject);
|
|
// var
|
|
// hp: string;
|
|
begin
|
|
{$IFDEF DB_ENABLED}
|
|
enterPwdDlg(hp, getTranslation('History password'), 16);
|
|
SetDBPass(hp);
|
|
{$ENDIF DB_ENABLED}
|
|
end;
|
|
|
|
procedure TsecurityFr.updateVisPage;
|
|
begin
|
|
histcryptEnableChk.Width := GetWidth(histcryptEnableChk);
|
|
cryptGroup.visible := histcryptEnableChk.checked;
|
|
CplPwdChk.enabled := dontsavepwdChk.checked;
|
|
{$IFDEF RNQ_FULL}
|
|
{$ELSE}
|
|
histcryptChangeBtn.visible := FALSE;
|
|
{$ENDIF}
|
|
{$IFDEF DB_ENABLED}
|
|
HistCryptBtn.visible := True;
|
|
{$ELSE ~DB_ENABLED}
|
|
HistCryptBtn.visible := FALSE;
|
|
{$ENDIF ~DB_ENABLED}
|
|
end;
|
|
|
|
end.
|