diff --git a/sources/MVCFramework.View.Renderers.TemplatePro.pas b/sources/MVCFramework.View.Renderers.TemplatePro.pas index bffb8df1..8b272bf6 100644 --- a/sources/MVCFramework.View.Renderers.TemplatePro.pas +++ b/sources/MVCFramework.View.Renderers.TemplatePro.pas @@ -180,6 +180,7 @@ begin begin lCompiledTemplate.SetData(lPair.Key, ViewModel[lPair.Key]); end; + lCompiledTemplate.SetData('LoggedUserName', WebContext.LoggedUser.UserName); end; lCompiledTemplate.AddFilter('json', DumpAsJSONString); lCompiledTemplate.AddFilter('count', GetDataSetOrObjectListCount); diff --git a/sources/MVCFramework.pas b/sources/MVCFramework.pas index 7b6a0231..783022ec 100644 --- a/sources/MVCFramework.pas +++ b/sources/MVCFramework.pas @@ -513,11 +513,11 @@ type FCustomData: TMVCCustomData; procedure SetLoggedSince(const AValue: TDateTime); procedure SetCustomData(const Value: TMVCCustomData); + function GetIsValid: Boolean; public constructor Create; destructor Destroy; override; - function IsValid: Boolean; procedure Clear; procedure SaveToSession(const AWebSession: TMVCWebSession); @@ -528,6 +528,7 @@ type property LoggedSince: TDateTime read FLoggedSince write SetLoggedSince; property Realm: string read FRealm write FRealm; property CustomData: TMVCCustomData read FCustomData write SetCustomData; + property IsValid: Boolean read GetIsValid; end; TWebContext = class @@ -2131,7 +2132,7 @@ begin inherited Destroy; end; -function TUser.IsValid: Boolean; +function TUser.GetIsValid: Boolean; begin Result := (not UserName.IsEmpty) and (LoggedSince > 0); end;