Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters #30

Open
yourilefers opened this issue Feb 2, 2016 · 3 comments
Open

Special characters #30

yourilefers opened this issue Feb 2, 2016 · 3 comments

Comments

@yourilefers
Copy link

When the password contains generated special characters (like '('), it crashed. We had to implemented something like this:

http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex

on line 133 of the 0.2 version. I have no idea wether this has been fixed in 0.3, because bower could not fetch that version. That version has also not yet been 'compiled' (minified).

@Bitblade
Copy link

Be warned, the 0.2 version contains a lot of gotcha's. For instance, the progressbar is blue instead of red for weak passwords because the wrong classes are used. (Line 183/184, the error is obvious when comparing to the lines below) It also tends to ignore a lot of special characters because it uses a regex with a very limited subset of special characters. I believe I fixed that by using regexes like /\W|_/g

After some difficulty with (very) outdated dependencies, I just managed to get the 0.3 version working, which still contains the escape issue.

@Yongshuai-Liu
Copy link

To fix special char bug:
1 . Add this function.
function escapeRegExp(str) {
return str.replace(/[-[]/{}()*+?.^$|]/g, "$&");
}

2. Update line 133 to var _reg = new RegExp(escapeRegExp(_p[i]), 'g');

To fix the blue color bar bug:

  1. Update line 183/184 to
    outter: scope.outterClassPrefix + 'danger',
    inner: scope.innerClassPrefix + 'danger'

Cheers.

@BenWoodford
Copy link

BenWoodford commented Dec 17, 2016

I found @YoshiDatoutou's solution wasn't working for me, I suspect it's GitHub messing with the formatting though:

.replace(/[\\\-\[\]\/\{\}\(\)\*\+\?\.\^\$\|]/g, "\$&")

was the line I had to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants