Skip to content

Instantly share code, notes, and snippets.

@andrew-serrano
Last active July 11, 2019 17:34
Show Gist options
  • Save andrew-serrano/2c631e12ee90c6761e26e221cf068ad0 to your computer and use it in GitHub Desktop.
Save andrew-serrano/2c631e12ee90c6761e26e221cf068ad0 to your computer and use it in GitHub Desktop.
HTML5/Miva Store Settings Customer Password Validation
<mvt:comment>
Using these english punctuation characters as reference
https://7esl.com/punctuation-marks/
Miva Settings:
l.settings:page:customer_settings:pw_complex = 0 No Complexity Requirements
l.settings:page:customer_settings:pw_complex = 1 At Least one Letter and one Number or Punctuation Character
l.settings:page:customer_settings:pw_complex = 2 Mixed Case Letters and at Least one Number or Punctuation Character
</mvt:comment>
<mvt:do file="g.Module_Feature_CUS_DB" name="l.CustomerSettings_Load" value="CustomerSettings_Load(l.settings:page:customer_settings)" />
<mvt:comment>
Use customer settings
</mvt:comment>
<mvt:if expr="l.CustomerSettings_Load">
<mvt:comment>
Default
</mvt:comment>
<mvt:assign name="l.settings:page:customer_settings:regexp_pattern" value="'(?=.*(?:\d|[\.\?,!:;()\[\]\/\x22\x27\x2D\u2013\u2014]))[\w\.\?,!:;()\[\]\/\x22\x27\x2D\u2013\u2014]{' $ l.settings:page:customer_settings:pw_min_len $ ',}'" />
<mvt:assign name="l.settings:page:customer_settings:password_information" value="'Password contain no spaces and must be a minimum of ' $ l.settings:page:customer_settings:pw_min_len $ ' characters and contain '" />
<mvt:if expr="l.settings:page:customer_settings:pw_complex EQ 1">
<mvt:comment>
Append additional information
</mvt:comment>
<mvt:assign name="l.settings:page:customer_settings:regexp_pattern" value="'(?=.*[A-z])' $ l.settings:page:customer_settings:regexp_pattern" />
<mvt:assign name="l.settings:page:customer_settings:password_information" value="l.settings:page:customer_settings:password_information $ 'one letter and one number or english punctuation character'" />
<mvt:elseif expr="l.settings:page:customer_settings:pw_complex EQ 2">
<mvt:comment>
Append additional information
</mvt:comment>
<mvt:assign name="l.settings:page:customer_settings:regexp_pattern" value="'(?=.*[A-Z])(?=.*[a-z])' $ l.settings:page:customer_settings:regexp_pattern" />
<mvt:assign name="l.settings:page:customer_settings:password_information" value="l.settings:page:customer_settings:password_information $ 'mixed case letters and at least one number or english punctuation character'" />
</mvt:if>
</mvt:if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment