def insertRegister(): registerDAO = RegisterDAO() registerVO = RegisterVO() loginDAO = LoginDAO() loginVO = LoginVO() loginVO.loginEmailId = request.form['registerEmailId'] loginDict = loginDAO.searchLoginByEmailId(loginVO) if loginDict: flash('EmailAddress Is Already Taken', 'success') return render_template('admin/register.html') registerVO.registerFirstName = request.form['registerFirstName'] registerVO.registerLastName = request.form['registerLastName'] registerVO.registerContact = request.form['registerContact'] registerVO.registerDate, registerVO.registerTime = str( datetime.now()).split(' ') registerVO.registerActiveStatus = 'active' loginVO.loginRole = 'user' loginVO.loginActiveStatus = 'active' loginVO.loginPassword = '******' loginDAO.insertLogin(loginVO) loginDict = loginDAO.getMaxId() registerVO.register_LoginId = loginDict[0]['MAX(loginId)'] registerDAO.insertRegister(registerVO) loginDict = loginDAO.searchLoginByEmailId(loginVO) session['loginRole'] = loginDict[0]['loginRole'] session['loginId'] = loginDict[0]['loginId'] fromaddr = "*****@*****.**" toaddr = loginVO.loginEmailId msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = "welcome to lemanhouse" msg.attach(MIMEText(loginVO.loginPassword, 'plain')) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login("*****@*****.**", "HeisenBerg_1102008") text = msg.as_string() server.sendmail(fromaddr, toaddr, text) server.quit() return redirect(url_for('home'))
def insertRegister(): registerDAO=RegisterDAO() registerVO=RegisterVO() loginDAO=LoginDAO() loginVO=LoginVO() registerVO.registerOrganizationname=request.form['registerOrganizatonname'] registerVO.registerContact=request.form['registerContact'] registerVO.registerCategory=request.form['registerCategory'] registerVO.registerAddress=request.form['registerAddress'] registerVO.register_LoginId = str(loginDAO.searchLoginId(loginVO)[0].values()[0]) loginVO.loginEmail = request.form['registerEmail'] loginVO.loginPassword = ''.join((random.choice(string.ascii_letters + string.digits)) for x in range(8)) loginVO.loginRole='user' print(loginVO.loginEmail) loginDict = loginDAO.searchLogin(loginVO) if len(loginDict) == 0: print("registerPassword="******"*****@*****.**" toaddr = loginVO.loginEmail msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = "PYTHON PASSWORD" msg.attach(MIMEText(loginVO.loginPassword, 'plain')) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(fromaddr, "BHAIbhai4725") text = msg.as_string() server.sendmail(fromaddr, toaddr, text) server.quit() loginDAO.insertLogin(loginVO) registerDAO.insertRegister(registerVO) return redirect(url_for('loadLogin')) else: flash('Email already exist !', 'danger') return redirect(url_for('loadRegister'))
def adminInsertRegister(): try: loginVO = LoginVO() loginDAO = LoginDAO() registerVO = RegisterVO() registerDAO = RegisterDAO() loginUsername = request.form['loginUsername'] registertrafficPoliceStationName = request.form[ 'registertrafficPoliceStationName'] registertrafficPoliceStationAreaName = request.form[ 'registertrafficPoliceStationAreaName'] registertrafficPoliceStationAddress = request.form[ 'registertrafficPoliceStationAddress'] registertrafficPoliceStationContact = request.form[ 'registertrafficPoliceStationContact'] loginPassword = ''.join( (random.choice(string.ascii_letters + string.digits)) for x in range(8)) print("loginPassword="******"*****@*****.**" receiver = loginUsername msg = MIMEMultipart() msg['From'] = sender msg['To'] = receiver msg['Subject'] = "TRAFFIC POLICE STATION LOGIN PASSWORD" msg.attach(MIMEText(loginPassword, 'plain')) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(sender, "trafficease123") text = msg.as_string() server.sendmail(sender, receiver, text) loginVO.loginUsername = loginUsername loginVO.loginPassword = loginPassword loginVO.loginRole = "user" loginVO.loginStatus = "active" print('hello') loginDAO.insertLogin(loginVO) registerVO.registertrafficPoliceStationName = registertrafficPoliceStationName registerVO.registertrafficPoliceStationAreaName = registertrafficPoliceStationAreaName registerVO.registertrafficPoliceStationAddress = registertrafficPoliceStationAddress registerVO.registertrafficPoliceStationContact = registertrafficPoliceStationContact registerVO.register_LoginId = loginVO.loginId registerDAO.insertRegister(registerVO) server.quit() return render_template("admin/login.html") except Exception as ex: print(ex)
def userInsertRegister(): try: loginUsername = request.form['loginUsername'] loginPassword = ''.join( (random.choice(string.ascii_letters + string.digits)) for x in range(8)) print("password="******"user" loginVO.loginStatus = "active" sender = "*****@*****.**" receiver = loginUsername msg = MIMEMultipart() msg['From'] = sender msg['To'] = receiver msg['Subject'] = "LOGIN PASSWORD" msg.attach(MIMEText(loginPassword, 'plain')) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(sender, "parents123eye123") text = msg.as_string() server.sendmail(sender, receiver, text) loginDAO.insertLogin(loginVO) registerFirstName = request.form['registerFirstName'] registerLastName = request.form['registerLastName'] registerAddress = request.form['registerAddress'] registerContact = request.form['registerContact'] registerVO = RegisterVO() registerDAO = RegisterDAO() registerVO.registerFirstName = registerFirstName registerVO.registerLastName = registerLastName registerVO.registerAddress = registerAddress registerVO.registerContact = registerContact registerVO.register_LoginId = loginVO.loginId registerDAO.insertRegister(registerVO) server.quit() return render_template("admin/login.html") except Exception as ex: print(ex)
def insertRegister(): registerDAO = RegisterDAO() registerVO = RegisterVO() loginDAO = LoginDAO() loginVO = LoginVO() loginVO.loginEmailId = request.form['registerEmailId'] registerDict = loginDAO.searchLogin(loginVO) if len(registerDict) > 0: return render_template('user/register.html', errorreg="*already registered") else: registerVO.registerFirstName = request.form['registerFirstName'] registerVO.registerLastName = request.form['registerLastName'] registerVO.registerGender = request.form['registerGender'] registerVO.registerAddress = request.form['registerAddress'] registerVO.registerPincode = request.form['registerPincode'] registerVO.registerContact = request.form['registerContact'] registerVO.registerDate, registerVO.registerTime = str( datetime.now()).split(' ') registerVO.registerActiveStatus = 'active' loginVO.loginRole = 'user' loginVO.loginActiveStatus = 'active' loginVO.loginPassword = ''.join( (random.choice(string.ascii_letters + string.digits)) for x in range(8)) fromaddr = "*****@*****.**" toaddr = loginVO.loginEmailId msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = "your password" msg.attach(MIMEText(loginVO.loginPassword, 'plain')) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(fromaddr, "iamdarshil") text = msg.as_string() server.sendmail(fromaddr, toaddr, text) server.quit() loginDAO.insertLogin(loginVO) loginDict = loginDAO.searchLoginId() registerVO.register_LoginId = loginDict[0]['max(loginId)'] registerDAO.insertRegister(registerVO) return redirect(url_for('loadLogin')) return redirect(url_for('loadLogin'))
def userInsertRegister(): try: loginVO = LoginVO() loginDAO = LoginDAO() registerVO = RegisterVO() registerDAO = RegisterDAO() loginUsername = request.form['loginUsername'] companyName = request.form['companyName'] registerFirstname = request.form['registerFirstname'] registerLastname = request.form['registerLastname'] registerGender = request.form['registerGender'] registerAddress = request.form['registerAddress'] registerContact = request.form['registerContact'] loginPassword = ''.join( (random.choice(string.ascii_letters + string.digits)) for x in range(8)) print("loginPassword= "******"dkppwd1998@") text = msg.as_string() server.sendmail(sender, receiver, text) loginVO.loginUsername = loginUsername loginVO.loginPassword = loginPassword loginVO.loginRole = 'user' loginVO.loginStatus = 'active' loginDAO.insertLogin(loginVO) registerVO.companyName = companyName registerVO.registerFirstname = registerFirstname registerVO.registerLastname = registerLastname registerVO.registerAddress = registerAddress registerVO.registerGender = registerGender registerVO.registerContact = registerContact registerVO.register_LoginId = loginVO.loginId registerDAO.insertRegister(registerVO) server.quit() return render_template('admin/login.html') except Exception as ex: print(ex)
def bloodbankInsertBloodBank(): try: loginVO = LoginVO() loginDAO = LoginDAO() bloodBankVO = BloodBankVO() bloodBankDAO = BloodBankDAO() loginUsername = request.form['loginUsername'] bloodBankName = request.form['bloodBankName'] bloodBank_CityId = request.form['bloodBank_CityId'] bloodBank_AreaId = request.form['bloodBank_AreaId'] bloodBankAddress = request.form['bloodBankAddress'] bloodBankContact = request.form['bloodBankContact'] bloodBankLicense = request.form['bloodBankLicense'] print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") loginPassword = ''.join( (random.choice(string.ascii_letters + string.digits)) for x in range(8)) print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") print("loginPassword="******"*****@*****.**" receiver = loginUsername msg = MIMEMultipart() msg['From'] = sender msg['To'] = receiver msg['Subject'] = "LOGIN PASSWORD" msg.attach(MIMEText('Your Password is:' + loginPassword, 'plain')) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(sender, "Qwer123@") text = msg.as_string() server.sendmail(sender, receiver, text) loginVO.loginUsername = loginUsername loginVO.loginPassword = loginPassword loginVO.loginRole = "bloodbank" loginVO.loginStatus = "active" loginVO.loginFileName = "None" print("###############################################") loginDAO.insertLogin(loginVO) print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$") bloodBankVO.bloodBankName = bloodBankName bloodBankVO.bloodBank_CityId = bloodBank_CityId bloodBankVO.bloodBank_AreaId = bloodBank_AreaId bloodBankVO.bloodBankAddress = bloodBankAddress bloodBankVO.bloodBankContact = bloodBankContact bloodBankVO.bloodBankLicense = bloodBankLicense bloodBankVO.bloodBank_LoginId = loginVO.loginId print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") bloodBankDAO.insertBloodBank(bloodBankVO) print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^") server.quit() return render_template("admin/takePicture.html", loginUsername=loginUsername) except Exception as ex: print(ex)
def adminInsertRegister(): try: if adminLoginSession() == 'admin': loginVO = LoginVO() loginDAO = LoginDAO() trafficPoliceStationVO = TrafficPoliceStationVO() trafficPoliceStationDAO = TrafficPoliceStationDAO() trafficPoliceStationUsername = request.form[ 'trafficPoliceStationUsername'] trafficPoliceStationName = request.form['trafficPoliceStationName'] trafficPoliceStation_AreaId = request.form[ 'trafficPoliceStation_AreaId'] trafficPoliceStationAddress = request.form[ 'trafficPoliceStationAddress'] trafficPoliceStationContact = request.form[ 'trafficPoliceStationContact'] loginPassword = ''.join( (random.choice(string.ascii_letters + string.digits)) for x in range(8)) sender = "*****@*****.**" receiver = trafficPoliceStationUsername msg = MIMEMultipart() msg['From'] = sender msg['To'] = receiver msg['Subject'] = "TRAFFIC POLICE STATION LOGIN PASSWORD" msg.attach(MIMEText(loginPassword, 'plain')) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(sender, "harshil3632") text = msg.as_string() server.sendmail(sender, receiver, text) loginVO.loginUsername = trafficPoliceStationUsername loginVO.loginPassword = loginPassword loginVO.loginRole = "user" loginVO.loginStatus = "active" loginVOList = loginDAO.insertLogin(loginVO) loginDictList = [i.as_dict() for i in loginVOList] trafficPoliceStationVO.trafficPoliceStationName = trafficPoliceStationName trafficPoliceStationVO.trafficPoliceStationContact = trafficPoliceStationContact trafficPoliceStationVO.trafficPoliceStationAddress = trafficPoliceStationAddress trafficPoliceStationVO.trafficPoliceStation_AreaId = int( trafficPoliceStation_AreaId) trafficPoliceStationVO.trafficPoliceStation_LoginId = loginDictList[ 0]['loginId'] trafficPoliceStationDAO.insertTrafficPoliceStation( trafficPoliceStationVO) server.quit() return redirect(url_for('adminViewTrafficPoliceStation')) else: adminLogoutSession() except Exception as ex: print(ex)
def userInsertUser(): try: loginVO = LoginVO() loginDAO = LoginDAO() userVO = UserVO() userDAO = UserDAO() loginUsername = request.form['loginUsername'] userFirstName = request.form['userFirstName'] userLastName = request.form['userLastName'] userBirthDate = request.form['userBirthDate'] user_BloodGroupId = request.form['user_BloodGroupId'] userGender = request.form['userGender'] userWeight = request.form['userWeight'] userHeight = request.form['userHeight'] user_CityId = request.form['user_CityId'] userDiseases = request.form['userDiseases'] user_AreaId = request.form['user_AreaId'] userAddress = request.form['userAddress'] userContact = request.form['userContact'] userFile = request.files['userFile'] print(userFile) userFileName = secure_filename(userFile.filename) print(userFileName) userFilePath = os.path.join(app.config['UPLOAD_FOLDER']) print(userFilePath) userFile.save(os.path.join(userFilePath, userFileName)) userVO.userFileName = userFileName userVO.userFilePath = userFilePath.replace("project", "..") print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") loginPassword = ''.join( (random.choice(string.ascii_letters + string.digits)) for x in range(8)) print("loginPassword="******"*****@*****.**" sender = "*****@*****.**" receiver = loginUsername msg = MIMEMultipart() msg['From'] = sender msg['To'] = receiver msg['Subject'] = "LOGIN PASSWORD" msg.attach(MIMEText('Your Password is:' + loginPassword, 'plain')) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() #server.login(sender, "qazwsxedcrfvtgb1234567890") server.login(sender, "Qwer123@") text = msg.as_string() server.sendmail(sender, receiver, text) loginVO.loginUsername = loginUsername loginVO.loginPassword = loginPassword loginVO.loginRole = "user" loginVO.loginStatus = "active" loginVO.loginFileName = "None" loginDAO.insertLogin(loginVO) userVO.user_CityId = user_CityId userVO.user_BloodGroupId = user_BloodGroupId userVO.userFirstName = userFirstName userVO.userLastName = userLastName userVO.userBirthDate = userBirthDate userVO.userGender = userGender userVO.userWeight = userWeight userVO.userHeight = userHeight userVO.userDiseases = userDiseases userVO.user_AreaId = user_AreaId userVO.userAddress = userAddress userVO.userContact = userContact userVO.user_LoginId = loginVO.loginId userDAO.insertUser(userVO) server.quit() return render_template("admin/takePicture.html", loginUsername=loginUsername) except Exception as ex: print(ex)
def userInsertRegister(): try: loginVO = LoginVO() loginDAO = LoginDAO() registerVO = RegisterVO() registerDAO = RegisterDAO() loginUsername = request.form["loginUsername"] loginVOList = loginDAO.findUser(loginUsername) print("check-----", loginVOList) loginDictList = [i.as_dict() for i in loginVOList] print(loginDictList) lenLoginDictList = len(loginDictList) if lenLoginDictList != 0: msg = "This Username Already Exist." return render_template('user/register.html', error=msg) else: loginPassword = ''.join( (random.choice(string.ascii_letters + string.digits)) for x in range(8)) registerFirstName = request.form['registerFirstName'] registerLastName = request.form['registerLastName'] registerMobileNumber = request.form['registerMobileNumber'] registerGender = request.form['registerGender'] print("loginPassword="******"*****@*****.**" receiver = loginUsername msg = MIMEMultipart() msg['From'] = sender msg['To'] = receiver msg['Subject'] = "YOUR AGRI-PEDIA PASSWORD" msg.attach( MIMEText( "Welcome To AGRI-PEDIA Family. ------------------ " + registerFirstName + " " + registerLastName + "\n \n ", 'plain')) msg.attach( MIMEText("Your Username is " + loginUsername + "\n", 'plain')) msg.attach( MIMEText("Your Password is " + loginPassword + "\n \n \n ", 'plain')) msg.attach( MIMEText( "Please Login to Website. Enter Username & Password And enjoy AGRI-PEDIA \n \n \n \n", 'plain')) msg.attach(MIMEText(" ~ ADMIN AGRI-PEDIA")) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(sender, "aimfs@12345") text = msg.as_string() server.sendmail(sender, receiver, text) loginVO.loginUsername = loginUsername loginVO.loginPassword = loginPassword loginVO.loginRole = "user" loginVO.loginStatus = "active" loginDAO.insertLogin(loginVO) registerVO.registerFirstName = registerFirstName registerVO.registerLastName = registerLastName registerVO.registerMobileNumber = registerMobileNumber registerVO.registerGender = registerGender registerVO.register_LoginId = loginVO.loginId registerDAO.insertRegister(registerVO) server.quit() return render_template("admin/Login.html") except Exception as ex: print(ex)