Subversion Repositories oidplus

Rev

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

Rev 790 Rev 800
Line 198... Line 198...
198
                        $handled = true;
198
                        $handled = true;
199
 
199
 
200
                        $ra_email = explode('$',$id)[1];
200
                        $ra_email = explode('$',$id)[1];
201
 
201
 
202
                        $out['title'] = _L('Change RA email');
202
                        $out['title'] = _L('Change RA email');
203
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
203
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,true).'img/main_icon.png' : '';
204
 
204
 
205
                        if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) {
205
                        if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) {
206
                                $out['icon'] = 'img/error_big.png';
206
                                $out['icon'] = 'img/error.png';
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->any()) {
212
                        if (!$res->any()) {
213
                                $out['icon'] = 'img/error_big.png';
213
                                $out['icon'] = 'img/error.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
 
218
                        if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()->isAdminLoggedIn()) {
218
                        if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()->isAdminLoggedIn()) {
219
                                $out['icon'] = 'img/error_big.png';
219
                                $out['icon'] = 'img/error.png';
220
                                $out['text'] = '<p>'._L('This functionality has been disabled by the administrator.').'</p>';
220
                                $out['text'] = '<p>'._L('This functionality has been disabled by the administrator.').'</p>';
221
                                return;
221
                                return;
222
                        }
222
                        }
223
 
223
 
224
                        if (OIDplus::authUtils()->isAdminLoggedIn()) {
224
                        if (OIDplus::authUtils()->isAdminLoggedIn()) {
Line 235... Line 235...
235
                                $out['text'] .= '<div><label class="padding_label">'._L('New address').':</label><input type="text" id="new_email" value=""/></div>';
235
                                $out['text'] .= '<div><label class="padding_label">'._L('New address').':</label><input type="text" id="new_email" value=""/></div>';
236
                                $out['text'] .= '<br><input type="submit" value="'._L('Change password').'"> '._L('(admin does not require email verification)').'</form>';
236
                                $out['text'] .= '<br><input type="submit" value="'._L('Change password').'"> '._L('(admin does not require email verification)').'</form>';
237
                        } else {
237
                        } else {
238
                                $ra = new OIDplusRA($ra_email);
238
                                $ra = new OIDplusRA($ra_email);
239
                                if ($ra->isPasswordLess()) {
239
                                if ($ra->isPasswordLess()) {
240
                                        $out['icon'] = 'img/error_big.png';
240
                                        $out['icon'] = 'img/error.png';
241
                                        $out['text'] .= '<p>'._L('Attention: You are logged in without password (via LDAP or Google OAuth etc.).').'</p>';
241
                                        $out['text'] .= '<p>'._L('Attention: You are logged in without password (via LDAP or Google OAuth etc.).').'</p>';
242
                                        $out['text'] .= '<p>'._L('Therefore, you cannot change your email address, otherwise you would love access to your account!').'</p>';
242
                                        $out['text'] .= '<p>'._L('Therefore, you cannot change your email address, otherwise you would love access to your account!').'</p>';
243
                                        $out['text'] .= '<p>'._L('If you want to change your email address, then please <a %1>setup a password</a> first, and then use the regular login method to log in using your new email address.', OIDplus::gui()->link('oidplus:change_ra_password$'.$ra_email)).'</p>';
243
                                        $out['text'] .= '<p>'._L('If you want to change your email address, then please <a %1>setup a password</a> first, and then use the regular login method to log in using your new email address.', OIDplus::gui()->link('oidplus:change_ra_password$'.$ra_email)).'</p>';
244
                                        return;
244
                                        return;
245
                                }
245
                                }
Line 257... Line 257...
257
                        $new_email = explode('$',$id)[2];
257
                        $new_email = explode('$',$id)[2];
258
                        $timestamp = explode('$',$id)[3];
258
                        $timestamp = explode('$',$id)[3];
259
                        $auth = explode('$',$id)[4];
259
                        $auth = explode('$',$id)[4];
260
 
260
 
261
                        $out['title'] = _L('Perform email address change');
261
                        $out['title'] = _L('Perform email address change');
262
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
262
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,true).'img/main_icon.png' : '';
263
 
263
 
264
                        if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()->isAdminLoggedIn()) {
264
                        if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()->isAdminLoggedIn()) {
265
                                $out['icon'] = 'img/error_big.png';
265
                                $out['icon'] = 'img/error.png';
266
                                $out['text'] = '<p>'._L('This functionality has been disabled by the administrator.').'</p>';
266
                                $out['text'] = '<p>'._L('This functionality has been disabled by the administrator.').'</p>';
267
                                return;
267
                                return;
268
                        }
268
                        }
269
 
269
 
270
                        $ra = new OIDplusRA($old_email);
270
                        $ra = new OIDplusRA($old_email);
271
                        if ($ra->isPasswordLess() && !OIDplus::authUtils()->isAdminLoggedIn()) {
271
                        if ($ra->isPasswordLess() && !OIDplus::authUtils()->isAdminLoggedIn()) {
272
                                $out['icon'] = 'img/error_big.png';
272
                                $out['icon'] = 'img/error.png';
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->any()) {
278
                        if (!$res->any()) {
279
                                $out['icon'] = 'img/error_big.png';
279
                                $out['icon'] = 'img/error.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->any()) {
283
                                if ($res->any()) {
284
                                        $out['icon'] = 'img/error_big.png';
284
                                        $out['icon'] = 'img/error.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.png';
289
                                                $out['text'] = _L('Invalid authorization. Is the URL OK?');
289
                                                $out['text'] = _L('Invalid authorization. Is the URL OK?');
290
                                        } else {
290
                                        } else {
291
                                                $out['text'] = '<p>'._L('Old eMail-Address').': <b>'.$old_email.'</b></p>
291
                                                $out['text'] = '<p>'._L('Old eMail-Address').': <b>'.$old_email.'</b></p>
292
                                                <p>'._L('New eMail-Address').': <b>'.$new_email.'</b></p>
292
                                                <p>'._L('New eMail-Address').': <b>'.$new_email.'</b></p>
293
 
293
 
Line 308... Line 308...
308
 
308
 
309
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
309
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
310
                if (!$ra_email) return false;
310
                if (!$ra_email) return false;
311
                if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) return false;
311
                if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) return false;
312
 
312
 
313
                if (file_exists(__DIR__.'/treeicon.png')) {
313
                if (file_exists(__DIR__.'/img/main_icon16.png')) {
314
                        $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png';
314
                        $tree_icon = OIDplus::webpath(__DIR__,true).'img/main_icon16.png';
315
                } else {
315
                } else {
316
                        $tree_icon = null; // default icon (folder)
316
                        $tree_icon = null; // default icon (folder)
317
                }
317
                }
318
 
318
 
319
                $json[] = array(
319
                $json[] = array(