Ubuchwepheshe obuqhamukayoUkumaketha Nge-imeyili Nokuzenzakalela Kwe-imeyili

Bheka Amandla Ephasiwedi nge-JavaScript kanye Nezincazelo Ezijwayelekile

Bengenza ucwaningo ngokuthola isibonelo esihle sesihloli sePhasiwedi esisebenzisayo i-JavaScript futhi Izinkulumo ezijwayelekile (Regex). Kuhlelo lokusebenza emsebenzini wami, senza okuthunyelwe emuva ukuqinisekisa amandla wephasiwedi futhi akukuhle neze kubasebenzisi bethu.

Yini i-Regex?

Isisho esijwayelekile ukulandelana kwezinhlamvu ezichaza iphethini yokusesha. Imvamisa, amaphethini anjalo asetshenziswa ngama-algorithm we-string search thola or thola bese ushintsha ukusebenza ngezintambo, noma ukuqinisekiswa kokufaka. 

Lo mbhalo nakanjani akufanele ukufundise izinkulumo ezijwayelekile. Yazi nje ukuthi amandla wokusebenzisa Izinkulumo Ezijwayelekile azokwenza lula ukukhula kwakho njengoba usesha amaphethini embhalweni. Kubalulekile futhi ukuqaphela ukuthi izilimi eziningi zentuthuko zithuthukise ukusetshenziswa kwezichasiso ezijwayelekile… ngakho-ke kunokuba zihlukanise futhi zicwaninge izintambo igxathu negxathu, iRegex imvamisa ishesha kakhulu kuzo zombili iseva nohlangothi lwamakhasimende.

Ngiseshe iwebhu kancane ngaphambi kokuthola isibonelo kwezinye izisho ezinhle ezijwayelekile ezifuna inhlanganisela yobude, izinhlamvu, nezimpawu. I-Howver, ikhodi yayiqine ngokweqile ukunambitheka kwami ​​futhi yenzelwe i-.NET. Ngakho-ke ngenza lula ikhodi ngayifaka kuJavaScript. Lokhu kuyenza iqinisekise amandla ephasiwedi ngesikhathi sangempela kusiphequluli seklayenti ngaphambi kokuyithumela futhi… futhi inikeze impendulo kumsebenzisi ngamandla wephasiwedi.

Thayipha iphasiwedi

Ngokushaywa ngakunye kwekhibhodi, iphasiwedi iyahlolwa ngokuqhathaniswa nenkulumo ejwayelekile bese impendulo inikezwa umsebenzisi esikhathini esingaphansi kwayo.




Thayipha iphasiwedi

Nayi ikhodi

The Izinkulumo ezijwayelekile yenza umsebenzi omuhle wokunciphisa ubude bekhodi:

  • Izinhlamvu eziningi - Uma ubude bungaphansi kwezinhlamvu eziyi-8.
  • ebuthakathaka - Uma ubude bungaphansi kwezinhlamvu eziyi-10 futhi bungaqukethe inhlanganisela yezimpawu, amakepisi, umbhalo.
  • Medium - Uma ubude buyizinhlamvu eziyi-10 noma ngaphezulu futhi bunenhlanganisela yezimpawu, amakepisi, umbhalo.
  • Strong - Uma ubude buyizinhlamvu eziyi-14 noma ngaphezulu futhi bunenhlanganisela yezimpawu, amakepisi, umbhalo.

<script language="javascript">
    function passwordChanged() {
        var strength = document.getElementById('strength');
        var strongRegex = new RegExp("^(?=.{14,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
        var mediumRegex = new RegExp("^(?=.{10,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
        var enoughRegex = new RegExp("(?=.{8,}).*", "g");
        var pwd = document.getElementById("password");
        if (pwd.value.length == 0) {
            strength.innerHTML = 'Type Password';
        } else if (false == enoughRegex.test(pwd.value)) {
            strength.innerHTML = 'More Characters';
        } else if (strongRegex.test(pwd.value)) {
            strength.innerHTML = '<span style="color:green">Strong!</span>';
        } else if (mediumRegex.test(pwd.value)) {
            strength.innerHTML = '<span style="color:orange">Medium!</span>';
        } else {
            strength.innerHTML = '<span style="color:red">Weak!</span>';
        }
    }
</script>
<input name="password" id="password" type="text" size="15" maxlength="100" onkeyup="return passwordChanged();" />
<span id="strength">Type Password</span>

Ukuqinisa Isicelo Sakho Sokungena

Kubalulekile ukuthi ungaqinisekisi ukwakhiwa kwephasiwedi ngaphakathi kweJavascript yakho. Lokhu kuzokwenza noma ngubani onamathuluzi wokuthuthukisa isiphequluli ukuthi adlule iskripthi futhi asebenzise noma iyiphi iphasiwedi angathanda. Kufanele NJALO usebenzise isheke-side isheke ukuqinisekisa amandla wephasiwedi ngaphambi kokuligcina kungxenyekazi yakho.

Douglas Karr

Douglas Karr ungumsunguli we Martech Zone kanye nochwepheshe owaziwayo wezinguquko zedijithali. UDoug uyi Isikhulumi Somphakathi Esisemqoka. Ungu-VP nomsunguli we Highbridge, inkampani egxile ekusizeni izinkampani zamabhizinisi ukuba ziguqule ngokwamanani futhi zikhulise ubuchwepheshe bazo bokutshala imali besebenzisa ubuchwepheshe beSalesforce. Usungule izindlela zokumaketha ezidijithali namasu womkhiqizo I-Dell Technologies, GoDaddy, Salesforce, Ama-Webtrends, Futhi I-SmartFOCUS. UDouglas futhi ungumbhali we Ukubhuloga Kwebhizinisi KwamaDummies futhi co-umbhali we Incwadi Engcono Yezebhizinisi.

Izihloko ezihlobene Nalesi

33 Amazwana

  1. NGIYABONGA! NGIYABONGA! NGIYABONGA! Bengilokhu ngikhohlisa amasonto ama-2 ngekhodi lamandla wephasiwedi elilahlekile kusuka kwamanye amawebhusayithi futhi ngikhipha izinwele zami. Okwakho kufushane, kusebenza ngendlela engifuna ngayo futhi okuhle kunakho konke, kulula ukuthi imfundamakhwela ye-JavaScript ikuguqule! Bengifuna ukuthatha isinqumo somandla futhi ngingavumeli okuthunyelwe kwefomu ukuthi kuvuselele empeleni iphasiwedi yomsebenzisi ngaphandle kokuthi kuhlangabezane nokuhlolwa kwamandla. Ikhodi yabanye abantu yayiyinkimbinkimbi kakhulu noma yayingasebenzi kahle noma enye into. Ngiyakuthanda! I-XXXXX

  2. Sawubona, okokuqala ngiyabonga kakhulu ngemizamo ye-ur, ngizamile ukusebenzisa lokhu ngeAsp.net kepha angisebenzi, ngisebenzisa

    esikhundleni sethegi, futhi ayisebenzi, noma iziphi iziphakamiso?!

  3. “I-P @ s $ w0rD” ikhombisa ngamandla, yize izonqamphuka ngokushesha okukhulu ngokuhlaselwa kwesichazamazwi…
    Ukufaka isici esinjalo kusisombululo se-professionnal, ngikholwa ukuthi kubalulekile ukuhlanganisa le algorithm nesheke lesichazamazwi.

  4. kukhona umuntu ongasho, ukuthi kungani kungasebenzanga okwami ​​..

    Ngikopishe yonke ikhodi, bese ngiyinamathisela ku-notepad ++, kepha ayisebenzi nhlobo?
    Ngicela ungisize..

  5. Lolu hlobo "lokuhlola amandla" luholela abantu phansi endleleni eyingozi kakhulu. Ikwazisa ukwehluka kwezinhlamvu ngobude bomushwana wokungena, okuyiholela ekulinganiseni amaphasiwedi amafushane, ahlukahlukene kakhulu kunamandla kunamaphasiwedi amade, angafani kakhulu. Lokho ngamanga okuzofaka abasebenzisi bakho enkingeni uma kungenzeka babhekane nosongo olunzima lokugenca.

  6. Ungumsindisi obukhoma! Bengicubungula izintambo kwesobunxele nesikhungo futhi ngicabanga ukuthi kunendlela engcono ngathola ucezu lwakho lwekhodi ngisebenzisa iRegex. Ngikwazile ukuxoxa ngayo ngesiza sami… Awazi ukuthi lokhu kusize kangakanani. Ngiyabonga kakhulu uDouglas !!

UCABANGANI?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.

Buyela emuva kunkinobho phezulu