Author Topic: Logout when password changes  (Read 10409 times)

Offline ramo102

  • Newbie
  • *
  • Posts: 5
Logout when password changes
« on: February 18, 2009, 09:07:14 AM »
Hi all,
I add the changepassword plugin from the link below to my Roundcube
installation:
wheaties.us || Andy and Natasha Wheatley's Blog

I need to logout after user change his password, so he can re-login with
the new one. I want to show an alert popup, and when the user clicks the
"OK" button, it will be redirected to the logout page.
I tried to add this line to the "app.js" file:

Code: [Select]
case 'save_changepasswd':
if (changepasswd_check_input())
{
  this.gui_objects.editform.submit();
--->  alert(this.get_label('passwdconfirm'));  <---
--->  this.switch_task(&quot;logout&quot;);              <---
}
break;


This actually works only when user inserts old and new password correctly.
But if the user
inserts a wrong old password, the alert popup fires anyway, because this
script is called
before testing submitted values with the db ones.
My questions is: where can I insert the above commands to get the right
behaviour?

Thanks in advance. :)

Offline Top44

  • Newbie
  • *
  • Posts: 4
Logout when password changes
« Reply #1 on: February 25, 2009, 04:21:03 PM »
My way to do that :

 echo "<meta http-equiv=\"refresh\" content=\"5;url=$PHP_SELF\" />";

into save_prefs.inc


greetz

Offline ramo102

  • Newbie
  • *
  • Posts: 5
Logout when password changes
« Reply #2 on: March 17, 2009, 12:18:04 PM »
Excuse me, but where I have to write this line?
I try to write it to the end of the file, but without any effect...

Offline ramo102

  • Newbie
  • *
  • Posts: 5
Logout when password changes
« Reply #3 on: March 18, 2009, 11:59:15 AM »
Quote from: Top44;17301
My way to do that :

 echo "<meta http-equiv=\"refresh\" content=\"5;url=$PHP_SELF\" />";

into save_prefs.inc


greetz


Now works! :D
I modified the suggested line to:
 echo "<meta http-equiv=\"refresh\" content=\"0;url=https://mydomain/roundcubemail/?_task=logout\" />";
Then I saved it in the save_changepasswd.inc file, in the following position:

    
if ($updated) {
        
// $_SESSION['password'] = $RCMAIL->encrypt_passwd($new_pw);
        
$OUTPUT->show_message('passwordchanged''confirmation');
        echo 
"<meta http-equiv=\"refresh\" content=\"0;url=https://mydomain/roundcubemail/?_task=logout\" />";

Offline along

  • Jr. Member
  • **
  • Posts: 18
Logout when password changes
« Reply #4 on: April 28, 2009, 03:28:11 AM »
thanks ramo102...wt the link on
wheaties.us || Andy and Natasha Wheatley's Blog

i follow instruction ....& manage to doit at 80% wt "password"tab....bt still can't use it...the problm is...when i click on the "password" tab..nothing happen..:o...it seem no link on taht tab?..

any ideas?..which setting i need to edit more...?..:eek:

Offline along

  • Jr. Member
  • **
  • Posts: 18
Logout when password changes
« Reply #5 on: April 28, 2009, 04:53:33 AM »
ok...now can see the tab after i refresh all the database and my server...when i try to change my password..it's succesfull but when i check on logs this come out...

[28-Apr-2009 08:16:50 +0000] DB Error: MDB2 Error: no such table Query: _doQuery: [Error message: Could not execute statement] [Last executed query: UPDATE database.table SET password_field =ENCRYPT('test7') WHERE user_name = 'xxx@xxx.com';] [Native code: 1146] [Native message: Table 'database.table' doesn't exist]  in C:\wamp\www\smail\program\include\rcube_mdb2.php on line 539 (POST /SMAIL/?_task=settings&_action=save-password)

the error show that no database exist...:-*
anybody can guide me how to add tables & for this matter..
my mailserver is Hmailsever & mydayabase mysql.
:confused:
tq..

Offline along

  • Jr. Member
  • **
  • Posts: 18
Logout when password changes
« Reply #6 on: April 28, 2009, 08:44:42 PM »
any ideas on this..?.

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Logout when password changes
« Reply #7 on: April 29, 2009, 01:03:10 AM »
Check MyRoundCube (see footer). There is a plugin for hMailServer to change the password.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline along

  • Jr. Member
  • **
  • Posts: 18
Logout when password changes
« Reply #8 on: April 29, 2009, 08:27:14 PM »
i'm no good on programing site....i saw the footer inside the >myplugins\collection\new_users_stats..trying search the database name...but...:D....lost somewhare!!!...:eek:..try all posible dbase  name ...got

[Native message: Table 'roundcubemail' doesn't exist]

do i need to create new table for this?.

:(

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Logout when password changes
« Reply #9 on: April 30, 2009, 12:31:34 AM »
Which database application do you use? What is you roundcube database name? How is the roundcube database structure? What is in the error log (./logs/errors)?
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline along

  • Jr. Member
  • **
  • Posts: 18
Logout when password changes
« Reply #10 on: May 03, 2009, 10:15:23 PM »
database : --> mysql

database name : ---> roundcubemail

structure :-->

error / log :-->

[Native message: Table 'roundcubemail.roundcubemail' doesn't exist]
 [4-May-2009 00:05:59 +0000] DB Error: MDB2 Error: no such table Query: _doQuery: [Error message: Could not execute statement] [Last executed query: UPDATE roundcubemail SET password_field =ENCRYPT('a') WHERE user_name = 'nazri@mailkal.ums.edu.my';] [Native code: 1146] [Native message: Table 'roundcubemail.roundcubemail' doesn't exist]  in C:\wamp\www\smail\program\include\rcube_mdb2.php on line 539 (POST /smail/?_task=settings&_action=save-password)

:-X0:)

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Logout when password changes
« Reply #11 on: May 04, 2009, 12:53:18 AM »
OK, now I see:


// YOU MUST CHANGE THIS QUERY LINE TO MATCH YOUR DATABASE SETTINGS !!!!!
    
	
$passwordquery "UPDATE database.table SET password_field =ENCRYPT('".$new_password."') WHERE user_name = '".$emailuser."';";


The above comment refers to the Database of your IMAP server. You have to adjust it that it finds the username field. There it should update the password field. In addition you have to use there a suitable encryption method. In addition it might be, that you have update other fields in that row too. This depenends on the IMAP server you are using. hMailServer f.e. also needs to update the field where the flag for the encryption method is stored.

So, the answer is:
#1- Check if your IMAP server stores the password in a MySQL database table.
#2- Analyze the table structure and find out the encryption method (lots use md5).
#3- Adjust the query that it fits your IMAP server requirement.

Just to clarify: The query has nothing to do with the roundcube database !!!
Regards,
Rosali
__________________
MyRoundcube Project (commercial)