Statistiques
| Révision:

root / LicensesMercure / UFConnect.pas @ 1

Historique | Voir | Annoter | Télécharger (1,808 ko)

1 1 avalancogn
unit UFConnect;
2
3
interface
4
5
uses
6
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7
  Dialogs, StdCtrls, Buttons, JvComponentBase, JvComputerInfoEx, JvExStdCtrls,
8
  JvEdit, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL,
9
  IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
10
  IdExplicitTLSClientServerBase, IdMessageClient, IdIMAP4;
11
12
type
13
  TFConnect = class(TForm)
14
    ComputerInfo: TJvComputerInfoEx;
15
    LLogin: TLabel;
16
    LPasswd: TLabel;
17
    ELogin: TEdit;
18
    BBOk: TBitBtn;
19
    BBCancel: TBitBtn;
20
    EPasswd: TJvEdit;
21
    LError: TLabel;
22
    IMAP4: TIdIMAP4;
23
    OpenSSL_IMAP4: TIdSSLIOHandlerSocketOpenSSL;
24
    procedure FormShow(Sender: TObject);
25
    procedure BBOkClick(Sender: TObject);
26
  private
27
    { Private declarations }
28
  public
29
    { Public declarations }
30
  end;
31
32
var
33
  FConnect: TFConnect;
34
35
implementation
36
37
{$R *.dfm}
38
39
uses
40
  UFMenu;
41
42
procedure TFConnect.BBOkClick(Sender: TObject);
43
begin
44
  FMenu.EUsername.Text := ELogin.Text;
45
  FMenu.EPassword.Text := EPasswd.Text;
46
  with IMAP4 do
47
  begin
48
    Host := IMAP_SERVER;
49
    Username := 'INRA\' + ELogin.Text + '\' + EXCHANGE_SHARED_MAILBOX;
50
    Password := EPasswd.Text;
51
  end;
52
  try
53
    IMAP4.Connect;
54
  except
55
    LError.Caption := 'Login ou mot de passe incorrect';
56
    ModalResult := mrNone;
57
    Exit;
58
  end;
59
  IMAP4.Disconnect;
60
  if (ELogin.Text <> 'avalancogne')
61
  and (ELogin.Text <> 'jvanmilgen')
62
  and (ELogin.Text <> 'jydourmad')
63
  and (ELogin.Text <> 'lbrossard') then
64
  begin
65
    LError.Caption := 'Utilisateur non autoris?';
66
    ModalResult := mrNone;
67
    Exit;
68
  end;
69
  FMenu.EAdmin.Text := ELogin.Text;
70
end;
71
72
procedure TFConnect.FormShow(Sender: TObject);
73
begin
74
  ELogin.Text := ComputerInfo.Identification.LocalUserName;
75
end;
76
77
end.