⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmpassword.pas

📁 Mailserver Source code - Delphi. Simple Mail server source code. SMTP and POP3 protocols.
💻 PAS
字号:
unit FrmPassword;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons;

type
  TFrmPassword1 = class(TForm)
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
  private
    { Private declarations }
  public
    { Public declarations }
    function Checktrue:boolean;
    procedure ClearEdit;
  end;

var
  FrmPassword1: TFrmPassword1;

implementation


{$R *.dfm}

//清空edits---------------------------------------------------------------------
procedure TFrmPassword1.ClearEdit;
begin
  edit1.text:='';
  edit2.text:='';
  edit3.text:='';
end;
//------------------------------------------------------------------------------

//检查合法性--------------------------------------------------------------------
function TFrmPassword1.Checktrue:boolean;
var
  i:integer;
begin
  result:=true;
  //用户明是否为空
  if trim(edit1.Text)='' then
  begin
    application.MessageBox('请输入由字母和数字组成的用户名。','提示信息',MB_ok or MB_ICONINFORMATION);
    result:=false;
    exit;
  end;
  //检查用户名是否包含非法字符
  for i:=1 to length(edit1.Text) do
  begin
    if (edit1.Text[i]<#48) or (edit1.Text[i]>#122) or ((edit1.Text[i]>#57) and (edit1.Text[i]<#65))
       or ((edit1.Text[i]>#90) and (edit1.Text[i]<#97)) then
    begin
      application.MessageBox('请输入由字母和数字组成的用户名。','提示信息',MB_ok or MB_ICONINFORMATION);
      result:=false;
      exit;
    end;
  end;

  //密码是否为空
  if trim(edit2.Text)='' then
  begin
    application.MessageBox('请输入由字母和数字组成的密码。','提示信息',MB_ok or MB_ICONQUESTION);
    result:=false;
    exit;
  end;
  //检查密码名是否包含非法字符
  for i:=1 to length(edit2.Text) do
  begin
    if (edit2.Text[i]<#48) or (edit2.Text[i]>#122) or ((edit2.Text[i]>#57) and (edit2.Text[i]<#65))
       or ((edit2.Text[i]>#90) and (edit2.Text[i]<#97)) then
    begin
      application.MessageBox('请输入由字母和数字组成的密码。','提示信息',MB_ok or MB_ICONQUESTION);
      result:=false;
      exit;
    end;
  end;

  if edit2.Text<>Edit3.Text then
  begin
    application.MessageBox('请确认两次密码输入是否正确。','提示信息',MB_ok or MB_ICONQUESTION);
    result:=false;
    exit;
  end;
end;
//------------------------------------------------------------------------------

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -