Skip to content

Commit

Permalink
Merge pull request #57 from misarb/checking-credentials
Browse files Browse the repository at this point in the history
Checking credentials
  • Loading branch information
ademclk authored Aug 25, 2022
2 parents 4121e96 + 6809b6e commit b5a926d
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
40 changes: 40 additions & 0 deletions programs/checking credentials/check_credentials.py
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)
21 changes: 21 additions & 0 deletions programs/checking credentials/test_check_credetianls.py
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







0 comments on commit b5a926d

Please sign in to comment.