def deleteseller():

    if session['loginDictrole'] == "admin":

        registerDAO = RegisterDAO()

        registerVO = RegisterVO()

        registerVO.registerId = request.form['registerId']

        registerDAO.deleteseller(registerVO)

        return redirect("/viewseller")
def userUpdateRegister():
    try:
        if adminLoginSession() == 'user':
            registerVO = RegisterVO()
            registerDAO = RegisterDAO()

            loginId = request.form['loginId']
            loginUsername = request.form['loginUsername']

            registerId = request.form['registerId']
            registerFirstName = request.form['registerFirstName']
            registerLastName = request.form['registerLastName']
            registerAddress = request.form['registerAddress']
            registerContact = request.form['registerContact']

            loginVO = LoginVO()
            loginDAO = LoginDAO()
            loginVO.loginId = loginId
            loginList = loginDAO.viewLogin(loginVO)

            if loginList[0].loginUsername == loginUsername:
                pass
            else:
                loginPassword = ''.join(
                    (random.choice(string.ascii_letters + string.digits))
                    for x in range(8))

                sender = "*****@*****.**"

                receiver = loginUsername

                msg = MIMEMultipart()

                msg['From'] = sender

                msg['To'] = receiver

                msg['Subject'] = "ACCOUNT 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)

                server.quit()

                loginVO.loginUsername = loginUsername
                loginVO.loginPassword = loginPassword

                loginDAO.updateLogin(loginVO)

            registerVO.registerId = registerId
            registerVO.registerFirstName = registerFirstName
            registerVO.registerLastName = registerLastName
            registerVO.registerAddress = registerAddress
            registerVO.registerContact = registerContact

            registerDAO.updateRegister(registerVO)
            return redirect(url_for('userLoadDashboard'))
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
Beispiel #3
0
def userupdateProfile():
    try:
        if adminLoginSession() == 'user':
            registerId = request.form['registerId']
            companyName = request.form['companyName']
            registerFirstname = request.form['registerFirstname']
            registerLastname = request.form['registerLastname']
            registerGender = request.form['registerGender']
            registerAddress = request.form['registerAddress']
            registerContact = request.form['registerContact']

            loginId = request.form['loginId']
            loginUsername = request.form['loginUsername']

            registerVO = RegisterVO()
            registerDAO = RegisterDAO()
            loginVO = LoginVO()
            loginDAO = LoginDAO()

            loginVO.loginId = loginId
            loginList = loginDAO.getLoginDetails(loginVO)

            if loginUsername != loginList[0].loginUsername:
                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)

                server.quit()

                loginVO.loginUsername = loginUsername
                loginVO.loginPassword = loginPassword

                loginDAO.updatePassword(loginVO)

            registerVO.registerId = registerId
            registerVO.companyName = companyName
            registerVO.registerFirstname = registerFirstname
            registerVO.registerLastname = registerLastname
            registerVO.registerAddress = registerAddress
            registerVO.registerGender = registerGender
            registerVO.registerContact = registerContact

            registerDAO.updateProfile(registerVO)

            return redirect(url_for('userLoadDashboard'))

        else:
            return adminLogoutSession()

    except Exception as ex:
        print(ex)