Пример #1
0
def userupdatePassword():
    try:
        if adminLoginSession() == 'user':

            oldPassword = request.form['oldPassword']
            newPassword = request.form['newPassword']
            confirmPassword = request.form['confirmPassword']

            loginId = session['session_loginId']
            loginUsername = session['session_loginUsername']

            loginVO = LoginVO()
            loginDAO = LoginDAO()

            loginVO.loginUsername = loginUsername

            loginVOList = loginDAO.loginUsername(loginVO)

            loginDictList = [i.as_dict() for i in loginVOList]

            print(loginDictList)

            for row in loginDictList:
                loginPassword = row['loginPassword']

                session['session_loginPassword'] = loginPassword

                session.permanent = True

                if session['session_loginPassword'] == oldPassword:
                    if newPassword == confirmPassword:

                        loginVO.loginId = loginId
                        loginVO.loginPassword = confirmPassword
                        loginDAO.updatePassword(loginVO)

                        return redirect(url_for('userLoadDashboard'))

                    else:
                        msg = "Your New and Confirm Password does not match!!!"
                        return render_template('user/changePassword.html',
                                               error=msg)
                else:
                    msg = "Your Old password is Incorrect!!!"
                    return render_template('user/changePassword.html',
                                           error=msg)

        else:
            return adminLogoutSession()

    except Exception as ex:
        print(ex)
Пример #2
0
def usernewPassword():
    try:
        userOTP = request.form['userOtp']
        if userOTP == session['session_OTP']:
            loginVO = LoginVO()
            loginDAO = LoginDAO()

            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 = receiver
            loginVO.loginId = session['session_loginId']
            loginVO.loginPassword = loginPassword

            loginDAO.updatePassword(loginVO)

            return render_template(
                "admin/login.html",
                error="Your new password is sent to your email address!")
        else:
            return render_template('admin/login.html',
                                   error="Invalid OTP,Please ty again!")
    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)