Login
TsgcHTMLComponent_Login — a ready-made login form with username, password, remember-me and error/success alerts, rendered as a card, centered or full-page layout, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_Login — a ready-made login form with username, password, remember-me and error/success alerts, rendered as a card, centered or full-page layout, in Delphi, C++ Builder and .NET.
A drop-in login component that emits a Bootstrap 5 form. Set the action, labels and style, optionally add a logo and footer link, then read the HTML property — or call GetFullPageHTML for a complete document.
TsgcHTMLComponent_Login
Bootstrap 5 login form markup
Delphi, C++ Builder, .NET
Set FormAction, the labels and LoginStyle, then read HTML — or call GetFullPageHTML to emit a complete HTML document.
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");
The members you reach for most often.
FormAction and FormMethod set where the form posts; FormID names it. The form always posts username, password and (optionally) remember.
Title, Subtitle, UserLabel, PasswordLabel, UserPlaceholder, PasswordPlaceholder and ButtonText control the copy.
LoginStyle picks lsCard, lsCentered or lsFullPage; ButtonStyleEnum, MaxWidth, MinHeight, BackgroundClass and CSSClass tune the look.
ShowRememberMe adds the checkbox; ErrorMessage and SuccessMessage render danger/success alerts above the form.
SetLogoText(aText) and SetFooterText(aText) are quick helpers; LogoHTML, FooterHTML, FooterLinkText and FooterLinkURL give full control.
HTML returns the form markup. GetFullPageHTML(const aPageTitle) emits a complete HTML document, linking BootstrapCSSPath and BootstrapJSPath.