How to check email ID, password and password should contain lowercase, uppercase and minimum characters and both fields should be inline?

   <!DOCTYPE html> 
    <html>
    <head>
    <title>Login Page</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet"href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
    </script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js">
    </script>
    </head>
    <body >     
    <div id="divi" height="100"> 
    <form class="form-inline" role="form">
    <div class="form-group" >
    <label class="sr-only" for="em">Email:</label>
    <input type="email" id="em" placeholder="Enter email" required >
    </div>
    <div class="form-group" >
    <label class="sr-only" for="pwd">Password:</label>
    <input type="password"  id="pwd" placeholder="Enter password" required>
    </div>
    <button type="button" class="btn btn-primary">Login</button>
    </form>
    </div>
    </body>
    </html>

Hi, please help me verify the user id with the email id, and should the password contain uppercase letters and at least one character?

+4
source share
1 answer

Follow this guide:

http://www.webdesignerdepot.com/2012/01/password-strength-verification-with-jquery/

Here is a sample jQuery code:

 //validate letter
 if ( pswd.match(/[A-z]/) ) {
     $('#letter').removeClass('invalid').addClass('valid');
} else {
     $('#letter').removeClass('valid').addClass('invalid');
}

//validate capital letter
if ( pswd.match(/[A-Z]/) ) {
    $('#capital').removeClass('invalid').addClass('valid');
} else {
    $('#capital').removeClass('valid').addClass('invalid');
}

//validate number
if ( pswd.match(/\d/) ) {
    $('#number').removeClass('invalid').addClass('valid');
} else {
    $('#number').removeClass('valid').addClass('invalid');
}

[AZ] These expressions verify that at least one letter is entered from A to Z (upper case) or through z (lower case)

[A-Z] ,

\ 0 9

+1

Source: https://habr.com/ru/post/1623630/


All Articles