December 2018
Intermediate to advanced
226 pages
4h 57m
English
Consider the second scenario as follows:
As an admin, you need to provide a script to users to add/delete themselves based upon authentication status and if authenticated successfully, provide an option to change their passwords:
...import getpass import base64import os.path###Check with credential storage file exists. If not, then create one, otherwise read data from the current filestoredcreds=[]if (os.path.isfile("usecase_creds.txt")): fopen=open("usecase_creds.txt") storedcreds=fopen.readlines()else: fopen=open("usecase_creds.txt","w")###Decrypt a given set of credentials def decryptcredential(pwd): rvalue=base64.b64decode(pwd) rvalue=rvalue.decode() return rvalue###Encrypt a given set of credentialsdef encryptcredential(pwd): ...Read now
Unlock full access