コード例 #1
0
def insertRegister():
    try:
        firstname = request.form['firstname']
        lastname = request.form['lastname']
        username = request.form['username']
        password = request.form['password']

        registerVO = RegisterVO()
        registerDAO = RegisterDAO()

        loginVO = LoginVO()
        loginDAO = LoginDAO()

        registerVO.registerFirstname = firstname
        registerVO.registerLastname = lastname
        registerVO.registerUsername = username
        registerVO.registerPassword = password

        loginVO.loginUsername = username
        loginVO.loginPassword = password

        registerDAO.insertRegister(registerVO)
        loginDAO.insertRegister(loginVO)

        return render_template('Login.html')

    except Exception as ex:
        print(ex)
コード例 #2
0
def userInsertRegister():
    try:

        loginVO = LoginVO()
        loginDAO = LoginDAO()

        registerVO = RegisterVO()
        registerDAO = RegisterDAO()

        loginUsername = request.form['loginUsername']
        print(loginUsername)

        registerFirstname = request.form['registerFirstname']
        registerLastname = request.form['registerLastname']
        registerAddress = request.form['registerAddress']
        registerContact = request.form['registerContact']

        loginPassword = ''.join((random.choice(string.ascii_letters + string.digits)) for x in range(8))

        print("loginPassword="******"*****@*****.**"
        print("+", sender)
        receiver = loginUsername
        print("++", receiver)
        msg = MIMEMultipart()

        msg['From'] = sender

        msg['To'] = receiver

        msg['Subject'] = "LOGIN PASSWORD"
        print('form')
        msg.attach(MIMEText(loginPassword, 'plain'))

        server = smtplib.SMTP('smtp.gmail.com', 587)

        server.starttls()
        print("few")

        server.login(sender, "your password")
        print("send")

        text = msg.as_string()

        server.sendmail(sender, receiver, text)
        print("email sent")

        loginVO.loginUsername = loginUsername
        loginVO.loginPassword = loginPassword
        loginVO.loginStatus = "active"
        loginVO.loginRole = "user"

        loginDAO.insertLogin(loginVO)

        registerVO.registerFirstname = registerFirstname
        registerVO.registerLastname = registerLastname
        registerVO.registerContact = registerContact
        registerVO.registerAddress = registerAddress
        registerVO.register_LoginId = loginVO.loginId

        registerDAO.insertRegister(registerVO)

        server.quit()

        return render_template("admin/login.html")

    except Exception as ex:
        print(ex)
コード例 #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)
コード例 #4
0
def userInsertRegister():
    try:
        loginVO = LoginVO()
        loginDAO = LoginDAO()

        registerVO = RegisterVO()
        registerDAO = RegisterDAO()

        loginUsername = request.form['loginUsername']
        loginPassword = ''.join(
            (random.choice(string.ascii_letters + string.digits))
            for x in range(8))

        registerFirstname = request.form['registerFirstname']
        registerLastname = request.form['registerLastname']
        registerGender = request.form['registerGender']
        registerAddress = request.form['registerAddress']
        registerContactNumber = request.form['registerContactNumber']

        print("loginPassword="******"*****@*****.**"

        receiver = loginUsername

        msg = MIMEMultipart()

        msg['From'] = sender

        msg['To'] = receiver

        msg['Subject'] = "PYTHON PASSWORD"

        msg.attach(MIMEText(loginPassword, 'plain'))
        print(loginPassword, "loginpassword")

        server = smtplib.SMTP('smtp.gmail.com', 587)

        server.starttls()

        server.login(sender, "9925646618")

        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.registerGender = registerGender
        registerVO.registerAddress = registerAddress
        registerVO.registerContactNumber = registerContactNumber
        registerVO.register_LoginId = loginVO.loginId

        registerDAO.insertRegister(registerVO)

        server.quit()

        return render_template("admin/login.html")

    except Exception as ex:
        print(ex)
コード例 #5
0
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']
            registerGender = request.form['registerGender']
            registerAddress = request.form['registerAddress']
            registerContactNumber = request.form['registerContactNumber']

            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, "9925646618")

                text = msg.as_string()

                server.sendmail(sender, receiver, text)

                server.quit()

                loginVO.loginUsername = loginUsername
                loginVO.loginPassword = loginPassword

                loginDAO.adminUpdateUser(loginVO)

            registerVO.registerId = registerId
            registerVO.registerFirstname = registerFirstname
            registerVO.registerLastname = registerLastname
            registerVO.registerGender = registerGender
            registerVO.registerAddress = registerAddress
            registerVO.registerContactNumber = registerContactNumber

            registerDAO.updateRegister(registerVO)

            return redirect(url_for('userLoadDashboard'))
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
コード例 #6
0
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)