You are not logged in.
Hello, according to example 30 - MVC ..., is it possible to check the session when a view is called? Example: when calling the "/ root / blog / dashboard" view, if the session does not exist, redirect to "/ root / blog / login".
Tks
Offline
Yes, raise a MVC exception with a goto redirection if there is no cookie session.
See for instance in sample 30:
procedure TBlogApplication.ArticleEdit(var ID: TID;
const Title,Content: RawUTF8; const ValidationError: variant;
out Article: TSQLArticle);
var AuthorID: PtrUInt;
begin
AuthorID := GetLoggedAuthorID(canPost,Article);
if AuthorID=0 then
raise EMVCApplication.CreateGotoError(sErrorNeedValidAuthorSession);
...
Offline
Thank you!
Offline