Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.


                <!doctype html>
<html lang="es">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="Generación de contraseñas seguras">
  <meta name="author" content="Gonzalo Chacaltana">
  <title>Generación de contraseñas seguras</title>
  <link href="" rel="stylesheet"
    integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous" />
  <meta name="theme-color" content="#563d7c" />
<body class="bg-light">
  <div class="container">
    <div class="py-5 text-center">
      <h2>Generar Contraseñas Seguras</h2>
      <p class="lead">
        En este sitio web puedes crear contraseñas aleatorias seguras para tus aplicaciones.
    <div class="row">
      <div class="col-md-4 order-md-2 mb-4">
        <h4 class="d-flex justify-content-between align-items-center mb-3">
          <span class="text-muted">Contraseñas Seguras</span>
          <span id="span_pass_number" class="badge badge-secondary badge-pill">0</span>
        <ul id="ul_passwords" class="list-group mb-3">
      <div class="col-md-8 order-md-1">
        <h4 class="mb-3">Configuración</h4>
        <form id="frmSecurePass" class="needs-validation">
          <hr class="mb-4">
          <div class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" id="chk_uppercase" checked="true">
            <label class="custom-control-label" for="chk_uppercase">Utilizar letras mayúsculas</label>
          <div class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" id="chk_lowercase" checked="true">
            <label class="custom-control-label" for="chk_lowercase">Utilizar letras minusculas </label>
          <div class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" id="chk_numbers" checked="true">
            <label class="custom-control-label" for="chk_numbers">Utilizar Números </label>
          <div class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" id="chk_symbols" checked="true">
            <label class="custom-control-label" for="chk_symbols">Utilizar simbolos </label>
          <hr class="mb-4">
          <div class="row">
            <div class="col-md-6 mb-3">
              <label for="cc-name">Longitud de contraseña</label>
              <input type="number" min="6" max="20" value="8" class="form-control" id="password_length"
                placeholder="Ejem: 10" required>
            <div class="col-md-6 mb-3">
              <label for="cc-number">Cantidad de contraseñas</label>
              <input type="number" min="1" value="3" max="15" class="form-control" id="password_count"
                placeholder="Ejem: 10" required>
          <hr class="mb-4">
          <button id="btnGenerate" class="btn btn-primary btn-lg btn-block" type="submit">Generar contraseñas</button>
    <footer class="my-5 pt-5 text-muted text-center text-small">
      <p class="mb-1">&copy; 2020 <a href="" target="_blank">Itensoft Digital Solutions</a></p>
      <ul class="list-inline">
        <li class="list-inline-item"><a href="" target="_blank">Política de
  <script src=""


                .container {
  max-width: 960px;

.lh-condensed {
  line-height: 1.25;


 * @file Script para generar contraseñas seguras.
 * @author Gonzalo Chacaltana <>
 * @class SecurePassword
 * @version 1.1
const SecurePassword = {
    password_length: 6,
    password_counter: 1,
    allowedValuesString: '',
    allowedValues: {
        lowercase: 'abcdefghijklmnopqrstuvwxyz',
        numbers: '0123456789',
        symbols: '!@#$%^&*()_+'
    validateChecked: function(){
        const chkboxes = document.getElementsByClassName("custom-control-input");
        let numberChecks = 0;, function(el) {
            if (el.checked) {
        if (numberChecks==0) {
            throw new Error("Debe seleccionar al menos una opción de valores permitidos.");
    generate: function () {
        this.password_length = parseInt(document.getElementById("password_length").value);
        this.password_counter = parseInt(document.getElementById("password_count").value);
        const ul = document.getElementById('ul_passwords');
        ul.innerHTML = '';
        for (let i = 0; i < this.password_counter; i++) {
            let li = document.createElement('li');
            li.className = "list-group-item d-flex justify-content-between lh-condensed";
            li.textContent = this.getPassword();
        document.getElementById("span_pass_number").textContent = this.password_counter;
    getAllowedValuesString: function () {
        if (document.getElementById("chk_uppercase").checked) {
            this.allowedValuesString += this.allowedValues.uppercase;
        if (document.getElementById("chk_lowercase").checked) {
            this.allowedValuesString += this.allowedValues.lowercase;
        if (document.getElementById("chk_numbers").checked) {
            this.allowedValuesString += this.allowedValues.numbers;
        if (document.getElementById("chk_symbols").checked) {
            this.allowedValuesString += this.allowedValues.symbols;
    getPassword: function () {
        let password = '';
        for (let i = 0; i < this.password_length; i++) {
            let random = Math.floor(Math.random() * this.allowedValuesString.length);
            password += this.allowedValuesString[random];
        return password;

(function () {
    'use strict'
    window.addEventListener('load', function () {
        const $frm = document.getElementById("frmSecurePass");
        $frm.addEventListener("submit", (e) => {
            try {
                const oSecurePassword = Object.create(SecurePassword);
            } catch (err) {
    }, false)