Is it possible to change the validation of user names in sitecore10.1? - sitecore

In previous versions of Sitecore, username validation was defined with setteing name=AccountNameValidation.
In Sitecore 10.1, when I look at the results of ShowConfig, I don't see any definition of AccountNameValidation.
How can I redefine the username validation in Sitecore 10.1?
Thank you for your help.

I have checked the Sitecore.Kernel.dll in dotpeek.
The same setting is still available. It is just not shown in showconfig.aspx since it is not part of any config file.
Below is the code of Sitecore.Configuration.KnownSettings.CoreSettings class.
So if you want to override the default validation, you can put the same setting in Sitecore.config or create a patch config file.
<setting name="AccountNameValidation" value="^\w[\w\s]*$"/>
Good to read.
https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0259229

Related

Getting crash when trying to set General Link value on sitecore

I am working on a template that have a General Link field, when I am trying to set the Insert link on Sitecore Content Editor I am getting below crash:
I am working on Sitecore 8.0 (rev.150121)
Even though the other General link options is working fine:
Insert media link
Insert external link
Insert anchor
Insert email
Insert JavaScript
I added a new field to the same template as a general link filed as well and it is working fine even for the Insert link option.
when I view the Raw value for the item I found that the link had a default value set to "" when I removed it and save all is working fine, the other testing link that I added do not have this default value, and the field on the template itself do not have such value or any default value.
This is a duplication of the question found on the Sitecore StackExchange here. Just to avoid any open question, here is the answer as provided in the same question:
The issue you reported was fixed in Sitecore Experience Platform 8.0 rev. 150621 (8.0 Update-4) and you can upgrade your solution to address the problem.
Please take a look at the reference number 416281 in Sitecore CMS release notes on for additional details on the fix: https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/8%200/Sitecore%20Experience%20Platform%2080%20Update4/Release%20notes
If upgrade is not an option for you, we suggest you implement the following workaround to resolve the issue on your current solution:
Place the attached Sitecore.Support.416281 assembly to the \bin folder of your solution;
Open /sitecore/system/Field types/Link Types/General Link item in the Core database;
Clean up its Control field;
Put Sitecore.Support.416281 in the Assembly field and Sitecore.Support.Link in the Class field;
Save changes.
Please download the assembly : https://www.dropbox.com/s/hl7ho6wmnca8u2y/Sitecore.Support.416281.dll?dl=0

How to remove broken links in Sitecore

We've got a Sitecore site where several items have broken links to an old workflow state that is no longer with us. I know that you can remove links when you delete an item, but I'm not seeing an interface to simple remove a broken link on an item, when the missing item is already gone.
What's the best way to remove broken links in this case? Thanks.
There is Sitecore admin page that allows removing broken links. You can find it here:
http://localhost/sitecore/admin/RemoveBrokenLinks.aspx
You just select the database and execute the action. You can also serialize all items changed during this process.
You may need to change timeout settings in web.config:
<setting name="DefaultSQLTimeout" value="10:00:00" />
<setting name="DataProviderTimeout" value="00:00:00" />
Sitecore maintains a table named Links in the database specified in the LinkDatabase section of web.config. You can get all broken links in following way:
Sitecore.Data.Database db = Sitecore.Context.Database;
Sitecore.Links.LinkDatabase linkDb = Sitecore.Globals.LinkDatabase;
Sitecore.Links.ItemLink[] brokenLinks = linkDb.GetBrokenLinks(db);

Sitecore: Detect user in Page Editor mode

Can I know how to detect user is in page editor mode using code?
This is because, I have a component, when user browses from page editor, it will search in master_index folder instead of web_index folder.
Please check with : if (Sitecore.Context.PageMode.IsPageEditorEditing)
also is working on Sitecore 6.6, it not depends on Sitecore 7.
Please check also this Sitecore blog post by Martina Welander.
To check if is normal page use: if (Sitecore.Context.PageMode.IsNormal)
To check if is preview mode use: if (Sitecore.Context.PageMode.IsPreview)
Also are others PageMode:
IsPageEditorClassic
IsPageEditorDesigning
IsPageEditorEditing
IsPageEditorNavigating, etc
If you are curious you can check with Reflector or dotPeek this class: Sitecore.Context.PageMode from Sitecore.Kernel assembly.
Rather than checking the page mode, I think you just want to piggyback on the context database name -
var indexName = Sitecore.Context.Database.Name + "_index";
I am using this syntax in view to add a class for JS detection, same code can be used for back-end detection with bit modification:
<html class="#(Sitecore.Context.PageMode.IsPageEditor ? "inexpeditor" : "notexpeditor")">

Umbraco error in Document Types

A long time ago I first setup a website in Umbraco. This seemed to be working fine.
I have now come back to it about a year later, and was initially getting the following error when selecting a Document Type (any document type in the Settings tab):
A bit weird, because earlier I didn't have this issue, but fine. I do what it says, and add <identity impersonate="true"/> to the <system.web> node in web.config.
While it does fix the initial issue, I now have the following on all document types:
When trying to create a new Document Type, I get the same kind of error, but then the ReturnUrl part is ReturnUrl=/umbraco/create.aspx?nodeId=init&nodeType=inittemplates&nodeName=Templates&rnd=20.2&rndo=21.2&nodeId=init&nodeType=inittemplates&nodeName=Templates&rnd=20.2&rndo=21.2' - but only if I tick the box 'Create template for this item'. The same happens when I try and create a Template.
After Googleing I came up with this: our.umbraco post with similar issue. One (unconfirmed) solution is that there's an illegal name in a document type/ template - but I haven't changed anything, and might be fixed by going into the database.
I did check the /masterpages folder, the only 'strange' characters in there are - and _.
In my Document Types I have on named 'Textpage (Two col)' and another named 'News & Events list'. I'm a bit hesitant to just delete them, since I don't have enough Umbraco knoledge to be sure this will fix my issue...
Is there any known solution for this, or will I also have to go into the database (and if so, whereabouts?)
I'm running Umbraco 4.7.2, assembly version 1.0.4500.21031.
I've hosted this site with GoDaddy.com - I don't know if that would be relevant.
[Update 1]
As per Tom Maton's comment:
The requirepermissions should be set to false, and have been.
in Appsettings I've set this:
<add key="umbracoUseMediumTrust" value="true" />
And I've added Trusted_Connection=yes to the connectionstring.
the problem remains.
[Update 2]
Tried the solution amelvin provided, but no dice. Doctypes and templates still give the error. I'm getting more certain it's some security issues. Which folder would correspond to the Templates? Would that be the masterpages folder? If so, what kind of permissions does that one need?
It could be that you don't have full trust on your Go Daddy environment?
Check this post out http://our.umbraco.org/forum/getting-started/installing-umbraco/17856-Umbraco-on-GoDaddy-Shared-Hosting
Could help resolve your issue.
The error could be a knock on from permissions errors as yet unsolved.
But the error is thrown if the content page does not have a template assigned or if Umbraco thinks it doesn't have a template. If absolutely nothing has changed to the site then it could be that the umbraco.config file has somehow got corrupted (it will contain all the doctype/template cross reference info). This can be fixed by right clicking on the top 'content' node and choose 'republish entire website'.
Secondly navigate to the settings | document types (if you can now) and check the templates dropdown on the first tab of the appropriate document type. If its set to 'please select' then this error will get thrown when any page tries to render without a valid template assigned. If a default template is assigned - then go to that template and re-publish it - Umbraco may have lost it.
If this does not work then check if the template is assigned properly. Go to the same place in the content tree as the problem page and try to add a node with the desired doctype. If no choices are offered then it could be that the parent tab no longer allows the correct doctypes as children nodes, so go back to the doctypes and check the allowed children (second tab) of the parent node.
If none of this works without odd errors being thrown then its a mystery!
Here are a list of Permissions required for Umbraco http://our.umbraco.org/wiki/reference/files-and-folders/permissions
Or you could use one of the steps below to check all the folder permissions.
http://our.umbraco.org/wiki/reference/files-and-folders/permissions/perform-permissions-check
Or install this package. http://our.umbraco.org/projects/backoffice-extensions/ugolive this will allow you to check the permissions are correctly setup.

How to get multiple language sites set up in Sitecore?

I am just starting to add support for multiple languages on my site... having a spot of trouble. Here are the steps I've taken so far:
In Control Panel -> Globalization, added a new language (German)
Added a new <site> definition in Web.config with hostName="localGerman.com" and language="de". Also added an alias in my hosts file for localgerman.com to point to localhost and added the host header in IIS.
Went to an item in my tree and added a new version for German. Published whole site.
Now, the host/site setup seems to work OK. When to go to http://localgerman.com/ I get my home page, with lots of missing data... there is no German version... so seems to be using the correct language.
However... when I go to the item I've added a German version of, I still get blank data. In the debugger, I can see that Sitecore.Context.Item is the German version... but all the fields are blank. Item["Content"] returns an empty string. If I manually set the language to "en" on the URL (http://localgerman.com/myitem.aspx?sc_lang=en), then I get the English version with data.
What am I missing here?
Also... when loading the German home page... my menu is blank. Presumably because the items which generate this content do not have German versions. I was under the assumption that when a language-specific version for a given item could not be loaded, then the default language version is used? But this does not seem to be the case. Am I wrong?
OK, looks like I just had the language code wrong. Setting the site language to "de-DE" instead of just "de" worked.
This is a little confusing because the default sites use language="en" instead of en-US.
You added a German version of an item, but did you fill in the fields in German ? Any localizable fields (non-shared) will be empty by default when a new version is created. It sounds like you did the other parts correctly.
The menu being blank is expected: When you try to get an language version of an item that doesn't exist, Sitecore will return null.