Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset expired password on connect #160

Open
megadrifter opened this issue Jan 19, 2021 · 0 comments
Open

Reset expired password on connect #160

megadrifter opened this issue Jan 19, 2021 · 0 comments

Comments

@megadrifter
Copy link

There is need to change expired password on connect.
cx_Oracle allows to do this as described https://cx-oracle.readthedocs.io/en/latest/user_guide/connection_handling.html?highlight=newpassword%3D#resetting-passwords

I did not find implementation in Your modules.

Resetting Passwords
After connecting, passwords can be changed by calling Connection.changepassword():

# Get the passwords from somewhere, such as prompting the user
oldpwd = getpass.getpass("Old Password for %s: " % username)
newpwd = getpass.getpass("New Password for %s: " % username)

connection.changepassword(oldpwd, newpwd)

When a password has expired and you cannot connect directly, you can connect and change the password in one operation by using the newpassword parameter of the function cx_Oracle.connect() constructor:

# Get the passwords from somewhere, such as prompting the user
oldpwd = getpass.getpass("Old Password for %s: " % username)
newpwd = getpass.getpass("New Password for %s: " % username)

connection = cx_Oracle.connect(username, oldpwd, "dbhost.example.com/orclpdb1",
        newpassword=newpwd, encoding="UTF-8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant