IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Flash Pascal Discussion :

Générateur de mot de passe


Sujet :

Flash Pascal

Mode arborescent

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Rédacteur/Modérateur

    Avatar de Roland Chastain
    Homme Profil pro
    Enseignant
    Inscrit en
    Décembre 2011
    Messages
    4 173
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Décembre 2011
    Messages : 4 173
    Billets dans le blog
    9
    Par défaut Générateur de mot de passe
    Bonjour !

    Il y avait quelque temps qu'il n'y avait plus de nouvelle discussion dans le forum FlashPascal. Je vous propose donc un générateur de mot de passe. J'ai utilisé la bibliothèque FlashCL.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
     
    (*----------------------------------------------------------------------------*)
    (* FlashPascal 2                                                              *)
    (* Générateur de mot de passe                                                 *)
    (* FlashCL : http://flashpascal.execute.re/FlashCL.php                        *)
    (* 03/09/2014 19:19:41                                                        *)
    (*----------------------------------------------------------------------------*)
     
    program Generateur;
     
    {$FRAME_WIDTH 540}
    {$FRAME_HEIGHT 400}
     
    uses
      Flash8, Classes, Controls, StdCtrls;
     
    const
      L = 'abcdefghijklmnopqrstuvwxyz';
      C = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
      D = '0123456789';
      S = '!#$%&()*+,-./:;<=>?@[\]^_{|}~';
     
    function RandomWord(
      aLength: integer;
      aDigits: boolean;
      aCapitals: boolean;
      aLowerChars: boolean;
      aSpecialChars: boolean): string;
    var
      a: array[1..4]of integer;
      i: integer;
    begin
      i := 0;
      if aDigits then
      begin
        Inc(i);
        a[i] := 1;
      end;
      if aCapitals then
      begin
        Inc(i);
        a[i] := 2;
      end;
      if aLowerChars then
      begin
        Inc(i);
        a[i] := 3;
      end;
      if aSpecialChars then
      begin
        Inc(i);
        a[i] := 4;
      end;
      result := '';
      if i > 0 then
        while Length(result) < aLength do
          case a[Trunc(i * Random + 1)] of
            1: result := result + D[Trunc(10 * Random + 1)];
            2: result := result + C[Trunc(26 * Random + 1)];
            3: result := result + L[Trunc(26 * Random + 1)];
            4: result := result + S[Trunc(Length(s) * Random + 1)];
          end;
    end;
     
    var
      bb: array[1..4] of TCheckBox;
      ff: array[1..5] of TextField;
     
    type
      TCustomButton = class(MovieClip)
        caption: TextField;
        procedure DrawButton(backColor, topColor, bottomColor, width, height: integer);
      end;
      TButton = class(TCustomButton)
        constructor Create(left, top, width, height: integer; aCaption: string);
        procedure doClick;
        procedure onRelease; override;
      end;
     
    { TCustomButton }
     
    procedure TCustomButton.DrawButton(
      backColor,
      topColor,
      bottomColor,
      width,
      height: integer
    );
    begin
      BeginFill(backColor);
      LineStyle(1, topColor);
      MoveTo(0, height);
      LineTo(0, 0);
      LineTo(width, 0);
      LineStyle(1, bottomColor);
      LineTo(width, height);
      LineTo(0, height);
      EndFill;
    end;
     
    { TButton }
     
    constructor TButton.Create(left, top, width, height: integer; aCaption: string);
    var
      f: textFormat;
    begin
      inherited Create(nil, '', GetNextHighestDepth());
      _x := left;
      _y := top;
      DrawButton($D0D0D0, $E0E0E0, $808080, width, height);
      caption := TextField.Create(
        self,
        '',
        GetNextHighestDepth(),
        0,
        5,
        width,
        height
      );
      caption.text := aCaption;
      f := TextFormat.Create('Arial', 12);
      f.align := 'center';
      caption.SetTextFormat(0, Length(caption.text), f);
      onPress := doClick;
    end;
     
    procedure TButton.doClick;
    var
      i: integer;
    begin
      DrawButton(
        $C0C0C0,
        $808080,
        $E0E0E0,
        integer(caption._width),
        integer(caption._height)
      );
      ff[5].text := '';
      if bb[1].checked
      or bb[2].checked
      or bb[3].checked
      or bb[4].checked then
        for i := 1 to integer(StrToInt(ff[4].text)) do
          ff[5].text := ff[5].text + RandomWord(
              integer(StrToInt(ff[2].text)),
              bb[1].checked,
              bb[2].checked,
              bb[3].checked,
              bb[4].checked
            ) + #13;
    end;
     
    procedure TButton.onRelease;
    begin
      DrawButton(
        $D0D0D0,
        $E0E0E0,
        $808080,
        integer(caption._width),
        integer(caption._height)
      );
    end;
     
    var
      i: integer;
      b: TButton;
      f: TextFormat;
     
    begin
      for i := Low(bb) to High(bb) do
      begin
        bb[i] := TCheckBox.Create(_root);
        with bb[i] do
          SetBounds(10, 30 * i - 20, 530, 21);
      end;
      bb[1].Caption := 'Inclure des chiffres (0..9).';
      bb[2].Caption := 'Inclure des lettres majuscules (A..Z).';
      bb[3].Caption := 'Inclure des lettres minuscules (a..z).';
      bb[4].Caption := 'Inclure des caract'"è"'res sp'"é"'ciaux (' + S + ').';
      bb[1].checked := TRUE;
      bb[3].checked := TRUE;
     
      f := textFormat.Create('Arial', 12);
     
      ff[1] := TextField.Create(_root, '', 4, 10, 130, 480, 21);
      ff[1].SetNewTextFormat(f);
      ff[1].Text := 'Nombre de caract'"è"'res souhait'"é"'s: ';
      ff[3] := TextField.Create(_root, '', 5, 10, 160, 480, 21);
      ff[3].SetNewTextFormat(f);
      ff[3].Text := 'Nombre de mots de passe '"à"' g'"é"'n'"é"'rer: ';
     
      ff[2] := TextField.Create(_root, '', 6, 500, 130, 30, 21);
      ff[2].SetNewTextFormat(f);
      ff[2].type := 'input';
      ff[2].border := TRUE;
      ff[2].text := '12';
     
      ff[4] := TextField.Create(_root, '', 7, 500, 160, 30, 21);
      ff[4].SetNewTextFormat(f);
      ff[4].type := 'input';
      ff[4].border := TRUE;
      ff[4].text := '10';
     
      ff[5] := TextField.Create(_root, '', 8, 10, 190, 520, 160);
      ff[5].SetNewTextFormat(f);
      ff[5].border := TRUE;
     
      b := TButton.Create(195, 360, 150, 30, 'G'"é"'n'"é"'rer');
    end.
    Fichiers attachés Fichiers attachés

Discussions similaires

  1. Votre avis sur ce code - Générateur de mot de passe
    Par austin57 dans le forum Tkinter
    Réponses: 4
    Dernier message: 22/09/2012, 23h34
  2. Générateur de Mot de Passe
    Par forum dans le forum Téléchargements
    Réponses: 0
    Dernier message: 03/06/2011, 16h32
  3. générateur de mot de passe
    Par cyborgtun dans le forum VB.NET
    Réponses: 0
    Dernier message: 19/05/2010, 21h10
  4. générateur de mot de passe
    Par zais_ethael dans le forum API standards et tierces
    Réponses: 1
    Dernier message: 18/05/2006, 15h47
  5. Générateur de mot de passe
    Par christel1982 dans le forum ASP
    Réponses: 2
    Dernier message: 16/11/2005, 12h25

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo