Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!doctype html>
<html>
    <head>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
        <meta charset="utf-8">
        <script>
            var passwordTypingTimer;         
            var passwordDoneTypingInterval = 400;
            // $('#myModal').modal('show')
            var passwordHelp = '<br>Try:<ul><li>Adding Special Symbols\n<li>Increasing the Length<li>Using Different case Letters<li>Numbers<li><a onclick="$(\'#breachInfo\').modal(\'show\')" href="#">About password breach data</a></ul>'

            var passwordScore = 0;
            function setupPasswordMeter(elemId) {
                $(document).ready(function() {
                $('#' + elemId).keyup(function(evt) {
                    var result  = zxcvbn(evt.target.value)
                    var score   = result.score
                    var message = result.feedback.warning || 'The password is weak';

                    if (score < 4) {
                        message += passwordHelp
                    } else {
                        message = '<span class="text-success">Strong password 💪</span>'
                    }
                    $('#passwordmessage').html(message);
                    
                    var $bar = $('#strengthBar');
                    passwordScore = score;
                    switch (score) {
                        case 0:
                            $bar.attr('class', 'progress-bar bg-danger')
                                .css('width', '1%');
                            break;
                        case 1:
                            $bar.attr('class', 'progress-bar bg-danger')
                                .css('width', '25%');
                            break;
                        case 2:
                            $bar.attr('class', 'progress-bar bg-danger')
                                .css('width', '50%');
                            break;
                        case 3:
                            $bar.attr('class', 'progress-bar bg-warning')
                                .css('width', '75%');
                            break;
                        case 4:
                            $bar.attr('class', 'progress-bar bg-success')
                                .css('width', '100%');
                            break;
                    }

                    clearTimeout(passwordTypingTimer);
                    passwordTypingTimer = setTimeout(passwordDoneTyping, passwordDoneTypingInterval)
                });
                });

            function passwordDoneTyping() {
                var password = $('#' + elemId)[0].value
                var passhash = sha1(password);
                $.get('https://api.pwnedpasswords.com/range/' + passhash.slice(0, 5), function ( data ) {
                    var hashes = {}
                    var rows = data.split('\n')
                    for (row in rows) {
                        var hashdata = rows[row].split(':')
                        hashes[hashdata[0]] = hashdata[1]
                    }
                    hashsuffix = passhash.slice(5, 40).toUpperCase()
                    var found = hashes[hashsuffix]
                    if(found !== undefined) {
                        if(passwordScore == 4) {
                            $('#passwordmessage').html('Password is strong, but has been breached<br>')
                        }
                        var msg = $('#passwordmessage').html()
                        msg = 'Password was involved in ' + found + ' password breaches <br>' + msg
                        if(passwordScore == 4) {
                            msg += passwordHelp
                        }
                        var $bar = $('#strengthBar');
                        $bar.attr('class', 'progress-bar bg-danger')
                            .css('width', '0%');             
                        $('#passwordmessage').html(msg);
                        
                    }
                });
            }    
            }         
        </script>
    </head>
    <body>
    <div class="modal" tabindex="-1" role="dialog" id="breachInfo">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">About Passwords and Breaches</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <p>How do we know if your password has been breached?  We use a service, haveibeenpwned.com, which maintains data on breaches. <strong>Your password is never sent to a third party.</strong> Instead, a security code is generated from your password and that security code is used to check if the password was involved in breaches. Your password can never be recovered using this security code.</p><p> For more details please see: <a href="https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange">Keeping your password secure</a></p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>       
        <div class="container">

                <div class="row">
                        <div class="col-md-8 col-sm-10 col-xs-12">
                            <form method="post" action="">
                                <div class="form-group">
                                    <label for="username">Username</label>
                                    <input class="form-control"
                                        type="username" 
                                        name="username" 
                                        value="" 
                                        required"required"
                                        placeholder="Enter username">
                                </div>
                                <div style="height:10px;">&nbsp;</div>
                            <div class="form-group">
                                <label for="password">Password</label>
                                <input type="password" id="password_id" name="password" class="form-control" id="exampleInputPassword1" placeholder="Password" value="">
                    
                                <div class="progress password-progress">
                                    <div id="strengthBar" class="progress-bar" role="progressbar" style="width: 0;"></div>
                                </div>
                                
                                <div class="text-danger" id="passwordmessage">
                                </div>            
                            </div>                            
                            <button type="submit" class="btn btn-primary">Signup</button>
                            </form>
                        </div>            
        </div>

        <script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha1/0.6.0/sha1.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js" integrity="sha384-6ePHh72Rl3hKio4HiJ841psfsRJveeS+aLoaEf3BWfS+gTF0XdAqku2ka8VddikM" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>                
        <script>
            setupPasswordMeter('password_id');              
        </script>
    </body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console