README.md in password_strength-1.0.0 vs README.md in password_strength-1.0.1
- old
+ new
@@ -121,11 +121,11 @@
## JavaScript
The PasswordStrength also implements the algorithm in the JavaScript.
-```ruby
+```javascript
var strength = PasswordStrength.test("johndoe", "mypass");
strength.isGood();
strength.isStrong();
strength.isWeak();
strength.isValid("good");
@@ -133,38 +133,38 @@
The API is basically the same!
You can use the `:exclude` option. Only regular expressions are supported for now.
-```ruby
+```javascript
var strength = PasswordStrength.test("johndoe", "password with whitespaces", {exclude: /\s/});
strength.isInvalid();
```
Additionaly, a jQuery plugin is available.
-```ruby
+```javascript
$.strength("#username", "#password");
```
The line above will validate the `#password` field against `#username`.
The result will be an image to the respective strength status. By default the image path will be
`/images/weak.png`, `/images/good.png` and `/images/strong.png`.
You can overwrite the image path and the default callback.
-```ruby
+```javascript
$.strength.weakImage = "/weak.png";
$.strength.goodImage = "/good.png";
$.strength.strongImage = "/strong.png";
$.strength.callback = function(username, password, strength) {
// do whatever you want
};
```
If you just want to overwrite the callback, you can simple do
-```ruby
+```javascript
$.strength("#username", "#password", function(username, password, strength){
// do whatever you want
});
```