-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from misarb/checking-credentials
Checking credentials
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+937 Bytes
programs/checking credentials/__pycache__/check_credentials.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+2.44 KB
...rams/checking credentials/__pycache__/test_check_credetianls.cpython-310-pytest-7.1.2.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import re | ||
def check_credentials(email,pswd): | ||
capitalAlpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
smallAlpha="abcdefghijklmnopqrstuvwxyz" | ||
specialchar="$@_" | ||
digits="0123456789" | ||
c,s ,sc,d=0,0,0,0 | ||
pswdLen = len(pswd) | ||
regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$' | ||
## password check | ||
if(pswdLen>7): | ||
for i in pswd : | ||
if(i in capitalAlpha): | ||
c = c +1 ## to count capital alphabatic in the input | ||
if(i in smallAlpha): | ||
s =s+1 ## to count the smalalphabitic | ||
if(i in specialchar): | ||
sc =sc +1 ## to count the specilachar | ||
if( i in digits): | ||
d=d+1 ## to count the digits | ||
if(c>=1 and s>=1 and sc>=1 and d >=1 and c+s+sc+d==pswdLen): | ||
print("password accepted") | ||
return True | ||
|
||
else: | ||
print("password not valid") | ||
return False | ||
|
||
## email check | ||
if(re.search(regex,email)): | ||
print("Email Valid") | ||
return True | ||
else: | ||
print("Email not valide ") | ||
return False | ||
|
||
|
||
# email =input("enter an Email :") | ||
# pswd = input("Enter a password :") | ||
# check_credentials(email,pswd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from ast import Assert | ||
from re import T | ||
import pytest | ||
from check_credentials import check_credentials as checkID | ||
|
||
mails = ['[email protected]', '[email protected]', '[email protected]', '01mail""[email protected]', '01mail"!,:"[email protected]', '[email protected]'] | ||
pswd = ['ssSS45@@qe','ssSS45@@qr'] | ||
def test_valide_email(): | ||
for i in mails: | ||
assert checkID(i,"ssSS45@@qr") is True | ||
|
||
def test_pswd_valide(): | ||
for i in pswd: | ||
assert checkID('x@gmailcom',i) is True | ||
|
||
|
||
|
||
|
||
|
||
|
||
|