# sfPasswordStrengthPlugin plugin The `sfPasswordStrengthPlugin` allows you to easily measure the strength of a password. It is displayed as a pretty progress bar. Inspired from [Password Strength validator](http://www.symfony-project.org/snippets/snippet/235) snippet Uses [Alix Axel algorithm](http://www.alixaxel.com/wordpress/2007/06/09/php-password-strength-algorithm/) ## Installation * Install the plugin symfony plugin-install http://plugins.symfony-project.com/sfPasswordStrengthPlugin * Make a symbolic link $ cd web $ ln -s ../plugins/sfPasswordStrengthPlugin/web sfPasswordStrengthPlugin * Create an action public function executeCalculateStrength() { $strength = PasswordStrength::calculate( $this->getRequestParameter('password'), $this->getRequestParameter('login') ); return $this->renderText(PasswordStrength::getBar($strength)); } * Add a DIV element where the bar will be placed and observe your field (note: you can see that the login is sent too, in order to test if the login is in the password, which is very bad!) echo observe_field('password', array( 'update' => 'strength', 'url' => 'user_account/calculateStrength', 'with' => "$('password').serialize() + '&' + $('login').serialize()", 'script' => true, 'frequency'=> 0.5, )); * Insert the style sheet (I hope this step will be automated soon!) <?php use_stylesheet('/sfPasswordStrengthPlugin/css/sfPasswordStrengthStyle.css'); ?> * You should be done.