1

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

I am trying to find out how to check to see if the user is logged in and if they are, do not load certain javascript files (we have a conflict that is causing problems with sitefinity's page editor)

So in the header I want to do something like

if(user_logged_in()) ... load js file here

Also I am trying to do this in the master template files.

Version 6.1 FYI

2 Answers 2

4

You can try:

ClaimsManager.GetCurrentIdentity().IsAuthenticated

This will return whether or not the user is logged in but it sounds like you need to know if they are a backend user so maybe try:

ClaimsManager.GetCurrentIdentity().IsBackendUser

You'll need this using directive:

using Telerik.Sitefinity.Security.Claims;
0
1

I think this might work for you. If the user is authenticated it will load you your .js file.

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);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.