Add regex to password complexity in Sitecore 8 -
the requirement require users have complex passwords requiring minimum length of 8 characters. 1+ non alpha numeric character. 1+ lowercase alpha character. 1+ uppercase alpha character. 1+ number.
i can accomplish adding following web.config
<add name="sql" type="system.web.security.sqlmembershipprovider" connectionstringname="core" applicationname="sitecore" minrequiredpasswordlength="8" minrequirednonalphanumericcharacters="1" requiresquestionandanswer="false" requiresuniqueemail="false" maxinvalidpasswordattempts="5" passwordstrengthregularexpression="(?=.{8,})(?=.*[\d])(?=.*[a-z])(?=.*[a-z]).*" />
passwordstrengthregularexpression validation seems not handled sitecore following unhandled exception when invalid password entered:
376 15:59:41 error application error. exception: system.web.httpunhandledexception message: exception of type 'system.web.httpunhandledexception' thrown. source: system.web @ system.web.ui.page.handleerror(exception e) @ system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) @ system.web.ui.page.processrequest(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) @ system.web.ui.page.processrequest() @ system.web.ui.page.processrequest(httpcontext context) @ system.web.httpapplication.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() @ system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) nested exception exception: system.reflection.targetinvocationexception message: exception has been thrown target of invocation. source: mscorlib @ system.runtimemethodhandle.invokemethod(object target, object[] arguments, signature sig, boolean constructor) @ system.reflection.runtimemethodinfo.unsafeinvokeinternal(object obj, object[] parameters, object[] arguments) @ system.reflection.runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture) @ sitecore.web.ui.xamlsharp.xaml.xamlcontrol.executeajaxmethod(ajaxmethodeventargs e) @ sitecore.web.ui.webcontrols.ajaxscriptmanager.dispatchmethod(control control, string parameters) @ sitecore.nexus.pipelines.nexuspipelineapi.resume(pipelineargs args, pipeline pipeline) @ sitecore.pipelines.pipeline.start(pipelineargs args, boolean atomic) @ sitecore.web.ui.webcontrols.continuationmanager.runpipelines() @ sitecore.web.ui.webcontrols.continuationmanager.onprerender(eventargs e) @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.control.prerenderrecursiveinternal() @ system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) nested exception exception: system.argumentexception message: parameter 'newpassword' not match regular expression specified in config file. source: system.web @ system.web.security.sqlmembershipprovider.changepassword(string username, string oldpassword, string newpassword) @ sitecore.data.dataproviders.nullretryer.execute[t](func`1 action, action recover) @ sitecore.security.sitecoremembershipprovider.changepassword(string username, string oldpassword, string newpassword) @ sitecore.security.accounts.membershipuserwrapper.changepassword(string oldpassword, string newpassword) @ sitecore.shell.applications.security.setpassword.setpasswordpage.ok_click()
can accomplished modifying config values or can accomplished patching <loggingin>
pipeline?
looking @ code sitecoremembershipprovider
there wrapper property passwordstrengthregularexpession
, material methods hand off processing underlying provider, in case sqlmembershipprovider
. error being generated there, see stack trace.
the exception expected behaviour method according msdn documentation. in application's login/change password/new user forms should validate user's entry against membership.passwordstrengthregularexpression
manually ensure complexity requirement met before passing new value sitecore.
it's hard tell question, cover case, or referring error being generated in sitecore change password dialog (haven't tried that)? if that's case raise support ticket, system should gracefully cope situation. notwithstanding documentation eluded nikola (@nsgocev) seems @ least author of sitecore wrapper did implement @ least rudimentary wrappers property.
Comments
Post a Comment