1

Topic: Cant login to admin after i changed password?!?

==== Required information ====
- iRedMail version: 0.8.3
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): iRedAdmin-Pro-MySQL-1.5.1
- Linux/BSD distribution name and version: CentOS 6.3
- Related log if you're reporting an issue:
====

Got the site running tonight and everything worked fine - i then went on to change the default email account password (postmaster@mydomain.com) in iredadmin. After that i cant login to iredadmin, but fine into roundcube. As i get it, they should be using the same entry in the database for users right?

What to do as now i cant get in and change anything sad
can i reset it somehow from phpmyadmin ??

thanks in advance

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Cant login to admin after i changed password?!?

i just get
Error: Username or password is incorrect
at iredadmin/login?msg=INVALID_CREDENTIALS

3

Re: Cant login to admin after i changed password?!?

managed to get in by adding a user in the "Admin" table in the database.

Though i think there might be a bug, cause if i edit the password on the mail user, that has the same email as an admin user, it deletes the admin user, and i cant login to the admin with that user anymore. (even though its set as global admin)

4

Re: Cant login to admin after i changed password?!?

We encourage to mark mail user as domain admin to avoid manage two passwords for same admin.

Could you help check columns mailbox.isadmin and mailbox.isglobaladmin in MYSQL database vmail after changed password? Thet should have the same value before and after password change.

5

Re: Cant login to admin after i changed password?!?

the values were

isglobaladmin = 1
isadmin = 0

so i guess i still should be able to login and not be rejected sad

6

Re: Cant login to admin after i changed password?!?

Oh, this looks like a bug in iRedAdmin-Pro. i will try reproducing this issue and fix it soon.

7 (edited by escu 2012-10-22 09:01:13)

Re: Cant login to admin after i changed password?!?

After I have encountered the same problem, I have read this topic and, based on what I've learned here, I played with the db a little.
This is what I have noticed:

- if you add the user to the admin table, you can login to admin panel, but in admin list you appear just as admin, not global admin. Meanwhile, in mailbox, values are: mailbox.isadmin=0, mailbox.isglobaladmin=1.

- if you change the mailbox.isadmin to 1, in admins appear the same admin twice, once as a normal admin and once as a global admin

- if you delete the user from the table admin but leave both isadmin and isglobaladmin to 1, everything goes back to normal.

I hope this helps in solving the bug.

8

Re: Cant login to admin after i changed password?!?

Dear Tue, escu,

I know what the problem is, but i'm still in hospital and have to delay this fix for about 1-2 days. I'm so sorry about this issue, and apologize for the delay. Thanks for your understanding and patience.

9

Re: Cant login to admin after i changed password?!?

Hi. Sorry to hear that. I wish you quick and full recovery and an iron health from now on. smile

Don't worry, we have the workout for this issue and it's posted here so others will use it untill you are available.

All the best!

10

Re: Cant login to admin after i changed password?!?

Hi Tue, escu,

Here's patch to fix this issue:

--- a/libs/mysql/user.py    2012-10-16 21:37:45.000000000 +0800
+++ b/libs/mysql/user.py    2012-10-24 08:17:55.000000000 +0800
@@ -306,7 +306,7 @@
         self.domain = self.mail.split('@', 1)[-1]
 
         # Pre-defined update key:value pairs
-        updates = {'modified': iredutils.getGMTTime(), 'isadmin': 0, }
+        updates = {'modified': iredutils.getGMTTime()}
 
         if self.profile_type == 'general':
             # Get settings of domain admin and global admin
@@ -315,6 +315,8 @@
                 # isadmin=1
                 updates['isadmin'] = 1
                 managed_domain=self.domain
+            else:
+                updates['isadmin'] = 0
 
             if session.get('domainGlobalAdmin'):
                 if 'domainGlobalAdmin' in data:
@@ -597,12 +599,12 @@
                 pass
 
         elif self.profile_type == 'advanced':
-            # Get enabled services.
+            # Get enabled/disabled services.
             self.enabledService = [str(v).lower()
                                    for v in data.get('enabledService', [])
                                    if v in ENABLED_SERVICES
                                   ]
-            self.disabledService = [v for v in ENABLED_SERVICES if v not in self.enabledService]
+            self.disabledService = []
 
             # Append 'sieve', 'sievesecured' for dovecot-1.2.
             if 'enablemanagesieve' in self.enabledService:
@@ -615,6 +617,8 @@
             else:
                 self.disabledService += ['enablesievesecured']
 
+            self.disabledService += [v for v in ENABLED_SERVICES if v not in self.enabledService]
+
             # Enable/disable services.
             for srv in self.enabledService:
                 updates[srv] = 1
@@ -657,9 +661,10 @@
             )
 
             # Update session immediately after updating SQL.
-            if not 'domainGlobalAdmin' in data and \
-               session.get('username') == self.mail:
-                session['domainGlobalAdmin'] = False
+            if profile_type == 'general':
+                if not 'domainGlobalAdmin' in data and \
+                   session.get('username') == self.mail:
+                    session['domainGlobalAdmin'] = False
 
             return (True,)
         except Exception, e:

11

Re: Cant login to admin after i changed password?!?

Hi ZhangHuangbin

I have the same issue but I have no idea how to apply your patch!? :-)

thank you!

regards

sela

12

Re: Cant login to admin after i changed password?!?

Save the patch to a diff file and apply it using patch command.