JSFiddle - React, Tailwind, and code Playground

by Victor Algaze

HTML

<h1>Small oversights --> Big problems </h1>

The recovery code is "steamy", try leaving it blank or substrings (s/st/ste/stea/steam)


<input type="text" id="passwordReset" value="steamy">

<button id="submitter">Submit</button>
    
<hr>
    See <a href="https://news.ycombinator.com/item?id=9953464" target="_blank">https://news.ycombinator.com/item?id=9953464</a> for context

JavaScript

function qualifyInput(input) {
    var token = "steamy"
    for (var i = 0; i < input.length; i++) {
        if (input[i] != token[i]) {
            return false;
        }

    }

    return true;


}


document.getElementById('submitter').onclick = function() {
    var input = document.getElementById('passwordReset').value;

    if (qualifyInput(input)) {
        alert('Valid!');
    } else {
        alert('invalid');
    }



}