Rev 279 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 279 | Rev 281 | ||
---|---|---|---|
Line 66... | Line 66... | ||
66 | } |
66 | } |
67 | 67 | ||
68 | public function gui($id, &$out, &$handled) { |
68 | public function gui($id, &$out, &$handled) { |
69 | if (explode('$',$id)[0] == 'oidplus:change_ra_password') { |
69 | if (explode('$',$id)[0] == 'oidplus:change_ra_password') { |
70 | $handled = true; |
70 | $handled = true; |
- | 71 | ||
- | 72 | $ra_email = explode('$',$id)[1]; |
|
- | 73 | ||
71 | $out['title'] = 'Change RA password'; |
74 | $out['title'] = 'Change RA password'; |
72 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
75 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
73 | 76 | ||
- | 77 | if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) { |
|
74 | $ra_email = explode('$',$id)[1]; |
78 | $out['icon'] = 'img/error_big.png'; |
- | 79 | $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b>.</p>'; |
|
- | 80 | return; |
|
- | 81 | } |
|
75 | 82 | ||
76 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
83 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
77 | if ($res->num_rows() == 0) { |
84 | if ($res->num_rows() == 0) { |
78 | $out['icon'] = 'img/error_big.png'; |
85 | $out['icon'] = 'img/error_big.png'; |
79 | $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist'; |
86 | $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist'; |
80 | return $out; |
87 | return; |
81 | } |
88 | } |
82 | 89 | ||
83 | if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) { |
- | |
84 | $out['icon'] = 'img/error_big.png'; |
- | |
85 | $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b>.</p>'; |
- | |
86 | } else { |
- | |
87 | $out['text'] .= '<form id="raChangePasswordForm" onsubmit="return raChangePasswordFormOnSubmit();">'; |
90 | $out['text'] .= '<form id="raChangePasswordForm" onsubmit="return raChangePasswordFormOnSubmit();">'; |
88 | $out['text'] .= '<input type="hidden" id="email" value="'.htmlentities($ra_email).'"/><br>'; |
91 | $out['text'] .= '<input type="hidden" id="email" value="'.htmlentities($ra_email).'"/><br>'; |
89 | $out['text'] .= '<div><label class="padding_label">E-Mail:</label><b>'.htmlentities($ra_email).'</b></div>'; |
92 | $out['text'] .= '<div><label class="padding_label">E-Mail:</label><b>'.htmlentities($ra_email).'</b></div>'; |
90 | if (OIDplus::authUtils()::isAdminLoggedIn()) { |
93 | if (OIDplus::authUtils()::isAdminLoggedIn()) { |
91 | $out['text'] .= '<div><label class="padding_label">Old password:</label><i>Admin can change the password without verification of the old password.</i></div>'; |
94 | $out['text'] .= '<div><label class="padding_label">Old password:</label><i>Admin can change the password without verification of the old password.</i></div>'; |
Line 95... | Line 98... | ||
95 | $out['text'] .= '<div><label class="padding_label">New password:</label><input type="password" id="new_password1" value=""/></div>'; |
98 | $out['text'] .= '<div><label class="padding_label">New password:</label><input type="password" id="new_password1" value=""/></div>'; |
96 | $out['text'] .= '<div><label class="padding_label">Repeat:</label><input type="password" id="new_password2" value=""/></div>'; |
99 | $out['text'] .= '<div><label class="padding_label">Repeat:</label><input type="password" id="new_password2" value=""/></div>'; |
97 | $out['text'] .= '<br><input type="submit" value="Change password"></form>'; |
100 | $out['text'] .= '<br><input type="submit" value="Change password"></form>'; |
98 | } |
101 | } |
99 | } |
102 | } |
100 | } |
- | |
101 | 103 | ||
102 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
104 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
- | 105 | if (!$ra_email) return false; |
|
- | 106 | if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) return false; |
|
- | 107 | ||
103 | if (file_exists(__DIR__.'/treeicon.png')) { |
108 | if (file_exists(__DIR__.'/treeicon.png')) { |
104 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
109 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
105 | } else { |
110 | } else { |
106 | $tree_icon = null; // default icon (folder) |
111 | $tree_icon = null; // default icon (folder) |
107 | } |
112 | } |