CRM እና የውሂብ መድረኮችየኢሜል ግብይት እና አውቶሜሽን

የይለፍ ቃል ጥንካሬን በጃቫስክሪፕት ወይም jQuery እና በመደበኛ መግለጫዎች ያረጋግጡ (ከአገልጋይ-ጎን ምሳሌዎች ጋር!)

የሚጠቀመውን የይለፍ ቃል ጥንካሬ አመልካች ጥሩ ምሳሌ ለማግኘት ጥቂት ምርምር እያደረግሁ ነበር ጃቫስክሪፕትመደበኛ መግለጫዎች (ሪጅክስ). በስራዬ ላይ ባለው መተግበሪያ ውስጥ የይለፍ ቃል ጥንካሬን ለማረጋገጥ ፖስት እናደርጋለን እና ለተጠቃሚዎቻችን በጣም የማይመች ነው።

ሬጌክስ ምንድን ነው?

መደበኛ አገላለጽ የፍለጋ ዘይቤን የሚወስኑ የቁምፊዎች ቅደም ተከተል ነው። ብዙውን ጊዜ እንደዚህ ዓይነቶቹ ቅጦች በ ‹ሕብረቁምፊ ፍለጋ› ስልተ ቀመሮች ጥቅም ላይ ይውላሉ ማግኘት or ይፈልጉ እና ይተኩ ክሮች ላይ ክዋኔዎች ፣ ወይም ለግብዓት ማረጋገጫ። 

ይህ ጽሑፍ በእርግጠኝነት መግለጫዎችን እንዲያስተምራችሁ አይደለም ፡፡ በጽሑፍ ውስጥ ቅጦችን ሲፈልጉ መደበኛ መግለጫዎችን የመጠቀም ችሎታ ልማትዎን በፍፁም እንደሚያቃልልዎት ይወቁ። በተጨማሪም ብዙ የልማት ቋንቋዎች የመደበኛ አገላለፅ አጠቃቀምን ያመቻቹ መሆናቸውን መገንዘብ አስፈላጊ ነው ፣ ስለሆነም ሪጌክስ ደረጃ በደረጃ ሕብረቁምፊዎችን ከመፈተሽ እና ከመፈለግ ይልቅ በተለምዶ በጣም ፈጣን አገልጋይ እና ደንበኛ ነው ፡፡

ከመገኘቴ በፊት ድሩን በጣም ፈለግሁ አንድ ምሳሌ የርዝመት፣ የገጸ-ባህሪያት እና የምልክቶች ጥምረት የሚፈልጉ አንዳንድ ምርጥ መደበኛ መግለጫዎች። ይሁን እንጂ ኮዱ ለኔ ጣዕም ትንሽ ከመጠን ያለፈ እና ለ NET የተዘጋጀ ነበር። ስለዚህ ኮዱን ቀለል አድርጌ ጃቫ ስክሪፕት ውስጥ አስቀመጥኩት። ይህ መልሶ ከመለጠፍዎ በፊት የይለፍ ቃል ጥንካሬን በቅጽበት በደንበኛው አሳሽ ላይ እንዲያረጋግጥ ያደርገዋል… እና ለተጠቃሚው የይለፍ ቃል ጥንካሬ አንዳንድ ግብረመልስ ይሰጣል።

A ይለፍ ቃል ይተይቡ

በእያንዳንዱ የቁልፍ ሰሌዳው ምት የይለፍ ቃሉ ከመደበኛው አገላለጽ ጋር ተፈትኖ ከዚያ በታችኛው ክፍል ውስጥ ለተጠቃሚው ግብረመልስ ይሰጣል

JavaScript የይለፍ ቃል ጥንካሬ ተግባር

መደበኛ መግለጫዎች የኮዱን ርዝመት በመቀነስ ድንቅ ስራ ያከናውኑ። ይህ የጃቫ ስክሪፕት ተግባር የይለፍ ቃል ጥንካሬን እና መክሸፍ ቀላል፣ መካከለኛ፣ ከባድ ወይም ለመገመት በጣም ከባድ መሆኑን ያረጋግጣል። ሰውዬው ሲተይብ፣ የበለጠ ጠንካራ እንዲሆን ለማበረታታት ጠቃሚ ምክሮችን ያሳያል። በሚከተለው መሰረት የይለፍ ቃሉን ያረጋግጣል፡-

  • ርዝመት - ርዝመቱ ከ 8 ቁምፊዎች በታች ወይም በላይ ከሆነ.
  • የተቀላቀለ መያዣ - የይለፍ ቃሉ ሁለቱም ከፍተኛ እና ዝቅተኛ ቁምፊዎች ካሉት.
  • ቁጥሮች - የይለፍ ቃሉ ቁጥሮችን የሚያካትት ከሆነ።
  • ልዩ ቁምፊዎች - የይለፍ ቃሉ ልዩ ቁምፊዎችን ያካተተ ከሆነ.

ተግባሩ አስቸጋሪነቱን እና የይለፍ ቃሉን የበለጠ ለማጠንከር አንዳንድ ምክሮችን ያሳያል።

function checkPasswordStrength(password) {
  // Initialize variables
  var strength = 0;
  var tips = "";

  // Check password length
  if (password.length < 8) {
    tips += "Make the password longer. ";
  } else {
    strength += 1;
  }

  // Check for mixed case
  if (password.match(/[a-z]/) && password.match(/[A-Z]/)) {
    strength += 1;
  } else {
    tips += "Use both lowercase and uppercase letters. ";
  }

  // Check for numbers
  if (password.match(/\d/)) {
    strength += 1;
  } else {
    tips += "Include at least one number. ";
  }

  // Check for special characters
  if (password.match(/[^a-zA-Z\d]/)) {
    strength += 1;
  } else {
    tips += "Include at least one special character. ";
  }

  // Return results
  if (strength < 2) {
    return "Easy to guess. " + tips;
  } else if (strength === 2) {
    return "Medium difficulty. " + tips;
  } else if (strength === 3) {
    return "Difficult. " + tips;
  } else {
    return "Extremely difficult. " + tips;
  }
}

የጫፉን ቀለም ማዘመን ከፈለጋችሁ ኮዱን ከገባ በኋላ በማዘመን ማድረግ ትችላላችሁ። // Return results መስመር.

// Get the paragraph element
  var strengthElement = document.getElementById("passwordStrength");

  // Return results
  if (strength < 2) {
    strengthElement.textContent = "Easy to guess. " + tips;
    strengthElement.style.color = "red";
  } else if (strength === 2) {
    strengthElement.textContent = "Medium difficulty. " + tips;
    strengthElement.style.color = "orange";
  } else if (strength === 3) {
    strengthElement.textContent = "Difficult. " + tips;
    strengthElement.style.color = "black";
  } else {
    strengthElement.textContent = "Extremely difficult. " + tips;
    strengthElement.style.color = "green";
  }

jQuery የይለፍ ቃል ጥንካሬ ተግባር

በ jQuery፣ በቅጹ ላይ በግቤት ዝማኔ መፃፍ የለብንም፡

<form>
    <label for="password">Enter password:</label>
    <input type="password" id="password">
    <p id="password-strength"></p>
</form>

ከፈለግን የመልእክቶቹን ቀለም መቀየር እንችላለን። 

$(document).ready(function() {
    $('#password').on('input', function() {
        var password = $(this).val();
        var strength = 0;
        var tips = "";
  
        // Check password length
        if (password.length < 8) {
            tips += "Make the password longer. ";
        } else {
            strength += 1;
        }
  
        // Check for mixed case
        if (password.match(/[a-z]/) && password.match(/[A-Z]/)) {
            strength += 1;
        } else {
            tips += "Use both lowercase and uppercase letters. ";
        }
  
        // Check for numbers
        if (password.match(/\d/)) {
            strength += 1;
        } else {
            tips += "Include at least one number. ";
        }
  
        // Check for special characters
        if (password.match(/[^a-zA-Z\d]/)) {
            strength += 1;
        } else {
            tips += "Include at least one special character. ";
        }
  
        // Update the text and color based on the password strength
        var passwordStrengthElement = $('#password-strength');
        if (strength < 2) {
            passwordStrengthElement.text("Easy to guess. " + tips);
            passwordStrengthElement.css('color', 'red');
        } else if (strength === 2) {
            passwordStrengthElement.text("Medium difficulty. " + tips);
            passwordStrengthElement.css('color', 'orange');
        } else if (strength === 3) {
            passwordStrengthElement.text("Difficult. " + tips);
            passwordStrengthElement.css('color', 'black');
        } else {
            passwordStrengthElement.text("Extremely difficult. " + tips);
            passwordStrengthElement.css('color', 'green');
        }
    });
});

የይለፍ ቃልዎን ማጠንከር

በጃቫ ስክሪፕትህ ውስጥ የይለፍ ቃል ግንባታን ብቻ እንዳታረጋግጥ በጣም አስፈላጊ ነው። ይህ ማንኛውም የአሳሽ ማጎልበቻ መሳሪያዎች ያለው ስክሪፕቱን እንዲያልፍ እና የፈለገውን የይለፍ ቃል እንዲጠቀም ያስችለዋል። የይለፍ ቃሉን ወደ መድረክዎ ከማጠራቀምዎ በፊት ጥንካሬን ለማረጋገጥ ሁል ጊዜ የአገልጋይ-ጎን ቼክን መጠቀም አለብዎት።

የ PHP ተግባር የይለፍ ቃል ጥንካሬ

function checkPasswordStrength($password) {
  // Initialize variables
  $strength = 0;

  // Check password length
  if (strlen($password) < 8) {
    return "Easy to guess";
  } else {
    $strength += 1;
  }

  // Check for mixed case
  if (preg_match("/[a-z]/", $password) && preg_match("/[A-Z]/", $password)) {
    $strength += 1;
  }

  // Check for numbers
  if (preg_match("/\d/", $password)) {
    $strength += 1;
  }

  // Check for special characters
  if (preg_match("/[^a-zA-Z\d]/", $password)) {
    $strength += 1;
  }

  // Return strength level
  if ($strength < 2) {
    return "Easy to guess";
  } else if ($strength === 2) {
    return "Medium difficulty";
  } else if ($strength === 3) {
    return "Difficult";
  } else {
    return "Extremely difficult";
  }
}

የፓይዘን ተግባር ለይለፍ ቃል ጥንካሬ

def check_password_strength(password):
  # Initialize variables
  strength = 0

  # Check password length
  if len(password) < 8:
    return "Easy to guess"
  else:
    strength += 1

  # Check for mixed case
  if any(char.islower() for char in password) and any(char.isupper() for char in password):
    strength += 1

  # Check for numbers
  if any(char.isdigit() for char in password):
    strength += 1

  # Check for special characters
  if any(not char.isalnum() for char in password):
    strength += 1

  # Return strength level
  if strength < 2:
    return "Easy to guess"
  elif strength == 2:
    return "Medium difficulty"
  elif strength == 3:
    return "Difficult"
  else:
    return "Extremely difficult"

C# ተግባር ለይለፍ ቃል ጥንካሬ

public string CheckPasswordStrength(string password) {
  // Initialize variables
  int strength = 0;

  // Check password length
  if (password.Length < 8) {
    return "Easy to guess";
  } else {
    strength += 1;
  }

  // Check for mixed case
  if (password.Any(char.IsLower) && password.Any(char.IsUpper)) {
    strength += 1;
  }

  // Check for numbers
  if (password.Any(char.IsDigit)) {
    strength += 1;
  }

  // Check for special characters
  if (password.Any(ch => !char.IsLetterOrDigit(ch))) {
    strength += 1;
  }

  // Return strength level
  if (strength < 2) {
    return "Easy to guess";
  } else if (strength == 2) {
    return "Medium difficulty";
  } else if (strength == 3) {
    return "Difficult";
  } else {
    return "Extremely difficult";
  }
}

የጃቫ ተግባር የይለፍ ቃል ጥንካሬ

public String checkPasswordStrength(String password) {
  // Initialize variables
  int strength = 0;

  // Check password length
  if (password.length() < 8) {
    return "Easy to guess";
  } else {
    strength += 1;
  }

  // Check for mixed case
  if (password.matches(".*[a-z].*") && password.matches(".*[A-Z].*")) {
    strength += 1;
  }

  // Check for numbers
  if (password.matches(".*\\d.*")) {
    strength += 1;
  }

  // Check for special characters
  if (password.matches(".*[^a-zA-Z\\d].*")) {
    strength += 1;
  }

  // Return strength level
  if (strength < 2) {
    return "Easy to guess";
  } else if (strength == 2) {
    return "Medium difficulty";
  } else if (strength == 3) {
    return "Difficult";
  } else {
    return "Extremely difficult";
  }
}

እና በጣም ጥሩ የይለፍ ቃል ጀነሬተር ብቻ እየፈለጉ ከሆነ ለዛ ጥሩ የሆነ ትንሽ የመስመር ላይ መሳሪያ ገንብቻለሁ።

የይለፍ ቃል አመንጪ።

Douglas Karr

Douglas Karr CMO ነው። ግንዛቤዎችን ይክፈቱ እና መስራች Martech Zone. ዳግላስ በደርዘኖች የሚቆጠሩ ስኬታማ የማርቴክ ጅምሮችን ረድቷል፣ በማርቴክ ግዥዎች እና ኢንቨስትመንቶች ከ$5 ቢሊዮን በላይ ተገቢውን ትጋት በማግኘቱ እና ኩባንያዎች የሽያጭ እና የግብይት ስልቶቻቸውን እንዲተገብሩ እና በራስ ሰር እንዲሰሩ ማገዙን ቀጥሏል። ዳግላስ በአለም አቀፍ ደረጃ እውቅና ያለው ዲጂታል ለውጥ እና የማርቴክ ባለሙያ እና ተናጋሪ ነው። ዳግላስ የዱሚ መመሪያ እና የንግድ ሥራ አመራር መጽሐፍ የታተመ ደራሲ ነው።

ተዛማጅ ርዕሶች

ወደ ላይኛው አዝራር ተመለስ
ገጠመ

ማስታወቂያ እገዳ ተገኝቷል

Martech Zone ይህንን ይዘት ያለ ምንም ወጪ ሊያቀርብልዎ ይችላል ምክንያቱም ገጻችንን በማስታወቂያ ገቢ፣ በተዛማጅ ማገናኛ እና በስፖንሰርነት ገቢ ስለምንፈጥር ነው። ጣቢያችንን ሲመለከቱ የማስታወቂያ ማገጃውን ቢያነሱት እናደንቃለን።