Login

TsgcHTMLComponent_Login — gotowy formularz logowania z nazwą użytkownika, hasłem, opcją zapamiętania mnie oraz alertami błędu/sukcesu, renderowany jako karta, układ wyśrodkowany lub pełnoekranowy, w Delphi, C++ Builder i .NET.

TsgcHTMLComponent_Login

Gotowy komponent logowania, który generuje formularz Bootstrap 5. Ustaw cel, etykiety i styl, opcjonalnie dodaj logo i link w stopce, a następnie odczytaj właściwość HTML — albo wywołaj GetFullPageHTML, aby uzyskać kompletny dokument.

Klasa komponentu

TsgcHTMLComponent_Login

Renderuje

Znaczniki formularza logowania Bootstrap 5

Języki

Delphi, C++ Builder, .NET

Utwórz go, skonfiguruj, wyrenderuj

Ustaw FormAction, etykiety i LoginStyle, a następnie odczytaj HTML — albo wywołaj GetFullPageHTML, aby wygenerować kompletny dokument HTML.

uses
  sgcHTML_Enums, sgcHTML_Component_Login;

var
  oLogin: TsgcHTMLComponent_Login;
begin
  oLogin := TsgcHTMLComponent_Login.Create(nil);
  try
    oLogin.FormAction := '/login';
    oLogin.FormMethod := 'POST';
    oLogin.Title := 'Sign in';
    oLogin.UserLabel := 'Email';
    oLogin.PasswordLabel := 'Password';
    oLogin.ShowRememberMe := True;
    oLogin.LoginStyle := lsFullPage;
    oLogin.ButtonStyleEnum := bsPrimary;
    oLogin.SetLogoText('Acme Inc.');
    oLogin.SetFooterText('Forgot your password?');

    WebModule.Response := oLogin.HTML;   // Bootstrap login form
  finally
    oLogin.Free;
  end;
end;

// Or emit a full standalone HTML document (with the Bootstrap links):
oLogin.BootstrapCSSPath := '/bootstrap.min.css';
Response := oLogin.GetFullPageHTML('Sign in — Acme');
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Login.hpp

TsgcHTMLComponent_Login *oLogin = new TsgcHTMLComponent_Login(NULL);
try
{
  oLogin->FormAction = "/login";
  oLogin->FormMethod = "POST";
  oLogin->Title = "Sign in";
  oLogin->UserLabel = "Email";
  oLogin->PasswordLabel = "Password";
  oLogin->ShowRememberMe = true;
  oLogin->LoginStyle = lsFullPage;
  oLogin->ButtonStyleEnum = bsPrimary;
  oLogin->SetLogoText("Acme Inc.");
  oLogin->SetFooterText("Forgot your password?");

  String html = oLogin->HTML;   // Bootstrap login form

  // Or a full standalone document:
  String page = oLogin->GetFullPageHTML("Sign in");
}
__finally
{
  delete oLogin;
}
using esegece.sgcWebSockets;

var login = new TsgcHTMLComponent_Login();
login.FormAction = "/login";
login.FormMethod = "POST";
login.Title = "Sign in";
login.UserLabel = "Email";
login.PasswordLabel = "Password";
login.ShowRememberMe = true;
login.LoginStyle = TsgcHTMLLoginStyle.lsFullPage;
login.ButtonStyleEnum = TsgcHTMLButtonStyle.bsPrimary;
login.SetLogoText("Acme Inc.");
login.SetFooterText("Forgot your password?");

string html = login.HTML;   // Bootstrap login form

// Or a full standalone document:
string page = login.GetFullPageHTML("Sign in");

Kluczowe właściwości i metody

Składniki, po które sięgasz najczęściej.

Formularz

FormAction i FormMethod ustawiają, dokąd formularz wysyła dane; FormID nadaje mu nazwę. Formularz zawsze wysyła username, password i (opcjonalnie) remember.

Etykiety i tekst

Title, Subtitle, UserLabel, PasswordLabel, UserPlaceholder, PasswordPlaceholder i ButtonText sterują treścią.

Styl

LoginStyle wybiera lsCard, lsCentered lub lsFullPage; ButtonStyleEnum, MaxWidth, MinHeight, BackgroundClass i CSSClass dostrajają wygląd.

Opcje i alerty

ShowRememberMe dodaje pole wyboru; ErrorMessage i SuccessMessage renderują alerty błędu/sukcesu nad formularzem.

Logo i stopka

SetLogoText(aText) i SetFooterText(aText) to szybkie metody pomocnicze; LogoHTML, FooterHTML, FooterLinkText i FooterLinkURL dają pełną kontrolę.

Wynik

HTML zwraca znaczniki formularza. GetFullPageHTML(const aPageTitle) generuje kompletny dokument HTML, dołączając BootstrapCSSPath i BootstrapJSPath.

Poznawaj dalej

Wszystkie komponenty sgcHTMLPrzejrzyj pełną matrycę funkcji 60+ komponentów.
Pobierz bezpłatną wersję próbną30-dniowa wersja próbna zawiera projekty demonstracyjne 60.HTML.
CennikLicencje Single, Team i Site z pełnym kodem źródłowym.

Gotowy, aby zacząć?

Pobierz bezpłatną wersję próbną i dodaj formularz logowania do swojej aplikacji webowej w Delphi, C++ Builder lub .NET.