Login
TsgcHTMLComponent_Login — 一个现成的登录表单,带有用户名、密码、记住我和错误/成功提示,可渲染为卡片、居中或全页布局,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_Login — 一个现成的登录表单,带有用户名、密码、记住我和错误/成功提示,可渲染为卡片、居中或全页布局,适用于 Delphi、C++ Builder 和 .NET。
一个即插即用的登录组件,发出 Bootstrap 5 表单。设置操作、标签和样式,可选地添加 logo 和页脚链接,然后读取 HTML 属性 — 或调用 GetFullPageHTML 以获得完整文档。
设置 FormAction、标签和 LoginStyle,然后读取 HTML — 或调用 GetFullPageHTML 以发出完整的 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");
您最常使用的成员。
FormAction 和 FormMethod 设置表单提交位置;FormID 为其命名。表单始终提交 username、password 和(可选的)remember。
Title、Subtitle、UserLabel、PasswordLabel、UserPlaceholder、PasswordPlaceholder 和 ButtonText 控制文案。
LoginStyle 选择 lsCard、lsCentered 或 lsFullPage;ButtonStyleEnum、MaxWidth、MinHeight、BackgroundClass 和 CSSClass 调整外观。
ShowRememberMe 添加复选框;ErrorMessage 和 SuccessMessage 在表单上方渲染危险/成功提示。
SetLogoText(aText) 和 SetFooterText(aText) 是快捷辅助方法;LogoHTML、FooterHTML、FooterLinkText 和 FooterLinkURL 提供完全控制。
HTML 返回表单标记。GetFullPageHTML(const aPageTitle) 发出完整的 HTML 文档,链接 BootstrapCSSPath 和 BootstrapJSPath。