This post discusses how to change the password of a liferay user at the database level to have him/her access to the portal instance
In order to do that you should have your database username and password handy
for our discussion, let me use TERMINAL BASH to connect to database, you can use any database client of your choice..
Connect to MySQL Service instance as follows...
Open a terminal and connect to MySQL as follows...
assuming USERNAME=root, PASSWORD=admin and DATABASE=lportal
this will ask you to provide password..
mysql> prompt would appear as a result of successful connetion to the database.
Before we change the password, I would like to give some hints on three important fields in the table User_, which are
password_ , passwordEncrypted , passwordReset
The password_ field : It's a varchar field, holds the user password in default encrypted format, i.e the encryption algorithm defined by liferay
The passwordEncrypted field : It's a tinyint field, tells liferay whether the password should take the encrypted or the plain text form
passwordEncrypted = 0; the password_ field will hold the password as plain text.
passwordEncrypted = 1; the password_ field will hold the password as encrypted text.
The passwordReset field : It's a tinyint field, tells liferay to make the user to reset the password as soon as they login
Let us pick a user whose password is to be changed...
Let us assume that we know the emailAddress of the user and let the emailAddress be "admin@liferay.com" having the emailAddress in hand we can query the database something like below
you will have the result as shown in the image below...
Now as you can see the password_ appears in encrypted form, passwordEncrypted holds '1' and passwordReset is '0'
This is how liferay stores user's password and this is the default behaviour of liferay..
In order to change the password of this user, we are going to update the above mentioned fields with the query as follows...
Now if you use the SELECT query we used just before the UPDATE query... you will have the result as follows...
As you can see the password_ field holds the password in plain text format, which is not the intention but this would be changed by the user when he/she logs into the portal using the password "test".
Well we have reached the end of our discussion, hope you find this post useful.
Please post your comments...
The targeted audience of this post is developers who develop the requirements on liferay portal
In order to do that you should have your database username and password handy
for our discussion, let me use TERMINAL BASH to connect to database, you can use any database client of your choice..
Connect to MySQL Service instance as follows...
Open a terminal and connect to MySQL as follows...
assuming USERNAME=root, PASSWORD=admin and DATABASE=lportal
> mysql --user=root --database=lportal --passwordPress enter
this will ask you to provide password..
mysql> prompt would appear as a result of successful connetion to the database.
Before we change the password, I would like to give some hints on three important fields in the table User_, which are
password_ , passwordEncrypted , passwordReset
The password_ field : It's a varchar field, holds the user password in default encrypted format, i.e the encryption algorithm defined by liferay
The passwordEncrypted field : It's a tinyint field, tells liferay whether the password should take the encrypted or the plain text form
passwordEncrypted = 0; the password_ field will hold the password as plain text.
passwordEncrypted = 1; the password_ field will hold the password as encrypted text.
The passwordReset field : It's a tinyint field, tells liferay to make the user to reset the password as soon as they login
Let us pick a user whose password is to be changed...
Let us assume that we know the emailAddress of the user and let the emailAddress be "admin@liferay.com" having the emailAddress in hand we can query the database something like below
mysql> SELECT userId, emailAddress, password_, passwordEncrypted, passwordReset FROM User_ WHERE emailAddress='admin@liferay.com';
you will have the result as shown in the image below...
Now as you can see the password_ appears in encrypted form, passwordEncrypted holds '1' and passwordReset is '0'
This is how liferay stores user's password and this is the default behaviour of liferay..
In order to change the password of this user, we are going to update the above mentioned fields with the query as follows...
mysql> UPDATE User_ set password_='test', passwordEncrypted=0, passwordReset=1 WHERE emailAddress = 'admin@liferay.com';
Now if you use the SELECT query we used just before the UPDATE query... you will have the result as follows...
As you can see the password_ field holds the password in plain text format, which is not the intention but this would be changed by the user when he/she logs into the portal using the password "test".
Well we have reached the end of our discussion, hope you find this post useful.
Please post your comments...
No comments:
Post a Comment