1 |
(* |
2 |
* IBX For Lazarus (Firebird Express) |
3 |
* |
4 |
* The contents of this file are subject to the Initial Developer's |
5 |
* Public License Version 1.0 (the "License"); you may not use this |
6 |
* file except in compliance with the License. You may obtain a copy |
7 |
* of the License here: |
8 |
* |
9 |
* http://www.firebirdsql.org/index.php?op=doc&id=idpl |
10 |
* |
11 |
* Software distributed under the License is distributed on an "AS |
12 |
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
13 |
* implied. See the License for the specific language governing rights |
14 |
* and limitations under the License. |
15 |
* |
16 |
* The Initial Developer of the Original Code is Tony Whyman. |
17 |
* |
18 |
* The Original Code is (C) 2015 Tony Whyman, MWA Software |
19 |
* (http://www.mwasoftware.co.uk). |
20 |
* |
21 |
* All Rights Reserved. |
22 |
* |
23 |
* Contributor(s): ______________________________________. |
24 |
* |
25 |
*) |
26 |
|
27 |
unit ChgPasswordDlgUnit; |
28 |
|
29 |
{$mode objfpc}{$H+} |
30 |
|
31 |
interface |
32 |
|
33 |
uses |
34 |
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, |
35 |
StdCtrls; |
36 |
|
37 |
type |
38 |
|
39 |
{ TChgPasswordDlg } |
40 |
|
41 |
TChgPasswordDlg = class(TForm) |
42 |
Bevel1: TBevel; |
43 |
Button1: TButton; |
44 |
Button2: TButton; |
45 |
Edit2: TEdit; |
46 |
Edit3: TEdit; |
47 |
Label2: TLabel; |
48 |
Label3: TLabel; |
49 |
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); |
50 |
procedure FormShow(Sender: TObject); |
51 |
private |
52 |
|
53 |
public |
54 |
function ShowModal(var Password: string): TModalResult; |
55 |
end; |
56 |
|
57 |
var |
58 |
ChgPasswordDlg: TChgPasswordDlg; |
59 |
|
60 |
implementation |
61 |
|
62 |
{$R *.lfm} |
63 |
|
64 |
{ TChgPasswordDlg } |
65 |
|
66 |
procedure TChgPasswordDlg.FormShow(Sender: TObject); |
67 |
begin |
68 |
Edit2.SetFocus; |
69 |
end; |
70 |
|
71 |
procedure TChgPasswordDlg.FormClose(Sender: TObject; |
72 |
var CloseAction: TCloseAction); |
73 |
begin |
74 |
if ModalResult = mrOK then |
75 |
begin |
76 |
if Edit2.Text <> Edit3.Text then |
77 |
begin |
78 |
MessageDlg('Passwords do not match',mtError,[mbOK],0); |
79 |
CloseAction := caNone; |
80 |
end; |
81 |
end; |
82 |
end; |
83 |
|
84 |
function TChgPasswordDlg.ShowModal(var Password: string): TModalResult; |
85 |
begin |
86 |
Edit2.Text := ''; |
87 |
Edit3.Text := ''; |
88 |
Result := inherited ShowModal; |
89 |
if Result = mrOK then |
90 |
Password := Edit2.Text; |
91 |
end; |
92 |
|
93 |
end. |
94 |
|