Subversion Repositories oidplus

Rev

Rev 635 | Rev 800 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 635 Rev 790
Line 45... Line 45...
45
                        if (!OIDplus::mailUtils()->validMailAddress($new_email)) {
45
                        if (!OIDplus::mailUtils()->validMailAddress($new_email)) {
46
                                throw new OIDplusException(_L('eMail address is invalid.'));
46
                                throw new OIDplusException(_L('eMail address is invalid.'));
47
                        }
47
                        }
48
 
48
 
49
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($old_email));
49
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($old_email));
50
                        if ($res->num_rows() == 0) {
50
                        if (!$res->any()) {
51
                                throw new OIDplusException(_L('eMail address does not exist anymore. It was probably already changed.'));
51
                                throw new OIDplusException(_L('eMail address does not exist anymore. It was probably already changed.'));
52
                        }
52
                        }
53
 
53
 
54
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($new_email));
54
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($new_email));
55
                        if ($res->num_rows() > 0) {
55
                        if ($res->any()) {
56
                                throw new OIDplusException(_L('eMail address is already used by another RA. To merge accounts, please contact the superior RA of your objects and request an owner change of your objects.'));
56
                                throw new OIDplusException(_L('eMail address is already used by another RA. To merge accounts, please contact the superior RA of your objects and request an owner change of your objects.'));
57
                        }
57
                        }
58
 
58
 
59
                        if (OIDplus::authUtils()->isAdminLoggedIn()) {
59
                        if (OIDplus::authUtils()->isAdminLoggedIn()) {
60
                                $ra_was_logged_in = OIDplus::authUtils()->isRaLoggedIn($old_email);
60
                                $ra_was_logged_in = OIDplus::authUtils()->isRaLoggedIn($old_email);
Line 130... Line 130...
130
                        if ((OIDplus::config()->getValue('max_ra_email_change_time') > 0) && (time()-$timestamp > OIDplus::config()->maxEmailChangeTime())) {
130
                        if ((OIDplus::config()->getValue('max_ra_email_change_time') > 0) && (time()-$timestamp > OIDplus::config()->maxEmailChangeTime())) {
131
                                throw new OIDplusException(_L('Activation link expired!'));
131
                                throw new OIDplusException(_L('Activation link expired!'));
132
                        }
132
                        }
133
 
133
 
134
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($old_email));
134
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($old_email));
135
                        if ($res->num_rows() == 0) {
135
                        if (!$res->any()) {
136
                                throw new OIDplusException(_L('eMail address does not exist anymore. It was probably already changed.'));
136
                                throw new OIDplusException(_L('eMail address does not exist anymore. It was probably already changed.'));
137
                        }
137
                        }
138
 
138
 
139
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($new_email));
139
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($new_email));
140
                        if ($res->num_rows() > 0) {
140
                        if ($res->any()) {
141
                                throw new OIDplusException(_L('eMail address is already used by another RA. To merge accounts, please contact the superior RA of your objects and request an owner change of your objects.'));
141
                                throw new OIDplusException(_L('eMail address is already used by another RA. To merge accounts, please contact the superior RA of your objects and request an owner change of your objects.'));
142
                        }
142
                        }
143
 
143
 
144
                        $ra = new OIDplusRA($old_email);
144
                        $ra = new OIDplusRA($old_email);
145
                        if (!$ra->isPasswordLess()) {
145
                        if (!$ra->isPasswordLess()) {
Line 207... Line 207...
207
                                $out['text'] = '<p>'._L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>').'</p>';
207
                                $out['text'] = '<p>'._L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>').'</p>';
208
                                return;
208
                                return;
209
                        }
209
                        }
210
 
210
 
211
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email));
211
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email));
212
                        if ($res->num_rows() == 0) {
212
                        if (!$res->any()) {
213
                                $out['icon'] = 'img/error_big.png';
213
                                $out['icon'] = 'img/error_big.png';
214
                                $out['text'] = _L('RA "%1" does not exist','<b>'.htmlentities($ra_email).'</b>');
214
                                $out['text'] = _L('RA "%1" does not exist','<b>'.htmlentities($ra_email).'</b>');
215
                                return;
215
                                return;
216
                        }
216
                        }
217
 
217
 
Line 273... Line 273...
273
                                $out['text'] = '<p>'._L('E-Mail-Address cannot be changed because this user does not have a password').'</p>';
273
                                $out['text'] = '<p>'._L('E-Mail-Address cannot be changed because this user does not have a password').'</p>';
274
                                return;
274
                                return;
275
                        }
275
                        }
276
 
276
 
277
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($old_email));
277
                        $res = OIDplus::db()->query("select * from ###ra where email = ?", array($old_email));
278
                        if ($res->num_rows() == 0) {
278
                        if (!$res->any()) {
279
                                $out['icon'] = 'img/error_big.png';
279
                                $out['icon'] = 'img/error_big.png';
280
                                $out['text'] = _L('eMail address does not exist anymore. It was probably already changed.');
280
                                $out['text'] = _L('eMail address does not exist anymore. It was probably already changed.');
281
                        } else {
281
                        } else {
282
                                $res = OIDplus::db()->query("select * from ###ra where email = ?", array($new_email));
282
                                $res = OIDplus::db()->query("select * from ###ra where email = ?", array($new_email));
283
                                if ($res->num_rows() > 0) {
283
                                if ($res->any()) {
284
                                        $out['icon'] = 'img/error_big.png';
284
                                        $out['icon'] = 'img/error_big.png';
285
                                        $out['text'] = _L('eMail address is already used by another RA. To merge accounts, please contact the superior RA of your objects and request an owner change of your objects.');
285
                                        $out['text'] = _L('eMail address is already used by another RA. To merge accounts, please contact the superior RA of your objects and request an owner change of your objects.');
286
                                } else {
286
                                } else {
287
                                        if (!OIDplus::authUtils()->validateAuthKey('activate_new_ra_email;'.$old_email.';'.$new_email.';'.$timestamp, $auth)) {
287
                                        if (!OIDplus::authUtils()->validateAuthKey('activate_new_ra_email;'.$old_email.';'.$new_email.';'.$timestamp, $auth)) {
288
                                                $out['icon'] = 'img/error_big.png';
288
                                                $out['icon'] = 'img/error_big.png';