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 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.
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.
TsgcHTMLComponent_Login
Znaczniki formularza logowania Bootstrap 5
Delphi, C++ Builder, .NET
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");
Składniki, po które sięgasz najczęściej.
FormAction i FormMethod ustawiają, dokąd formularz wysyła dane; FormID nadaje mu nazwę. Formularz zawsze wysyła username, password i (opcjonalnie) remember.
Title, Subtitle, UserLabel, PasswordLabel, UserPlaceholder, PasswordPlaceholder i ButtonText sterują treścią.
LoginStyle wybiera lsCard, lsCentered lub lsFullPage; ButtonStyleEnum, MaxWidth, MinHeight, BackgroundClass i CSSClass dostrajają wygląd.
ShowRememberMe dodaje pole wyboru; ErrorMessage i SuccessMessage renderują alerty błędu/sukcesu nad formularzem.
SetLogoText(aText) i SetFooterText(aText) to szybkie metody pomocnicze; LogoHTML, FooterHTML, FooterLinkText i FooterLinkURL dają pełną kontrolę.
HTML zwraca znaczniki formularza. GetFullPageHTML(const aPageTitle) generuje kompletny dokument HTML, dołączając BootstrapCSSPath i BootstrapJSPath.