예제 #1
0
def updateProfile():
    try:
        registerDAO = RegisterDAO()
        registerVO = RegisterVO()

        loginDAO = LoginDAO()
        loginVO = LoginVO()

        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']

        loginVO.loginEmailId = request.form['registerEmailId']
        loginVO.loginPassword = request.form['loginPassword']
        loginVO.loginId = registerVO.register_LoginId = request.form['loginId']

        loginDict = loginDAO.searchLoginIddata(loginVO)

        if loginVO.loginPassword == loginDict[0]['loginPassword']:
            loginDAO.updateProfile(loginVO)
            registerDAO.updateProfile(registerVO)
            return redirect(url_for('loadProfile'))
        else:
            session['error'] = "*wrong password Please enter again"
            return redirect(url_for('loadEditprofile'))
    except:
        return render_template('admin/login.html')
예제 #2
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)