SiteFinity if the user is logged in

I am new to SiteFinity. This is the first time I have ever seen it.

I am trying to figure out how to check if a user is registered and if there are any, do not upload certain javascript files (we have a conflict that causes problems with the site page editor)

So in the title I want to do something like

if (USER_LOGGED_IN ()) ... upload the js file here

I am also trying to do this in core template files.

Version 6.1 FYI

+1
source share
2 answers

You can try:

ClaimsManager.GetCurrentIdentity().IsAuthenticated

This will return if the user will be registered, but it looks like you need to know if they are a backend user, so maybe try:

ClaimsManager.GetCurrentIdentity().IsBackendUser

You will need this using the directive:

using Telerik.Sitefinity.Security.Claims;
+3

, . , .js .

var isValidUser = SecurityManager.AuthenticateUser(UserManager.GetDefaultProviderName(), userName, userPassword, true);
if (isValidUser == UserLoggingReason.Success){
   JavaScriptEmbedControl scriptToEmbed = new JavaScriptEmbedControl();
   scriptToEmbed.Url = "path-to-file.js";
   scriptToEmbed.ScriptEmbedPosition = Telerik.Sitefinity.Web.UI.PublicControls.Enums.ScriptEmbedPosition.InPlace;
   this.form1.Controls.Add(scriptToEmbed);
}
+1

All Articles