Subversion Repositories oidplus

Rev

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

Rev 1086 Rev 1116
Line 23... Line 23...
23
\defined('INSIDE_OIDPLUS') or die;
23
\defined('INSIDE_OIDPLUS') or die;
24
// phpcs:enable PSR1.Files.SideEffects
24
// phpcs:enable PSR1.Files.SideEffects
25
 
25
 
26
class OIDplusPageRaChangePassword extends OIDplusPagePluginRa {
26
class OIDplusPageRaChangePassword extends OIDplusPagePluginRa {
27
 
27
 
-
 
28
        /**
-
 
29
         * @param string $actionID
-
 
30
         * @param array $params
-
 
31
         * @return int[]
-
 
32
         * @throws OIDplusException
-
 
33
         */
28
        public function action($actionID, $params) {
34
        public function action(string $actionID, array $params): array {
29
                if ($actionID == 'change_ra_password') {
35
                if ($actionID == 'change_ra_password') {
30
                        _CheckParamExists($params, 'email');
36
                        _CheckParamExists($params, 'email');
31
 
37
 
32
                        $email = $params['email'];
38
                        $email = $params['email'];
33
 
39
 
Line 75... Line 81...
75
                        }
81
                        }
76
                        $ra->change_password($password1);
82
                        $ra->change_password($password1);
77
 
83
 
78
                        return array("status" => 0);
84
                        return array("status" => 0);
79
                } else {
85
                } else {
80
                        throw new OIDplusException(_L('Unknown action ID'));
86
                        return parent::action($actionID, $params);
81
                }
87
                }
82
        }
88
        }
83
 
89
 
-
 
90
        /**
-
 
91
         * @param bool $html
-
 
92
         * @return void
-
 
93
         */
84
        public function init($html=true) {
94
        public function init(bool $html=true) {
85
                // Nothing
95
                // Nothing
86
        }
96
        }
87
 
97
 
-
 
98
        /**
-
 
99
         * @param string $id
-
 
100
         * @param array $out
-
 
101
         * @param bool $handled
-
 
102
         * @return void
-
 
103
         * @throws OIDplusException
-
 
104
         */
88
        public function gui($id, &$out, &$handled) {
105
        public function gui(string $id, array &$out, bool &$handled) {
89
                if (explode('$',$id)[0] == 'oidplus:change_ra_password') {
106
                if (explode('$',$id)[0] == 'oidplus:change_ra_password') {
90
                        $handled = true;
107
                        $handled = true;
91
 
108
 
92
                        $ra_email = explode('$',$id)[1];
109
                        $ra_email = explode('$',$id)[1];
93
                        $ra = new OIDplusRA($ra_email);
110
                        $ra = new OIDplusRA($ra_email);
Line 122... Line 139...
122
                        $out['text'] .= '<div><label class="padding_label">'._L('Repeat').':</label><input type="password" id="new_password2" value=""/></div>';
139
                        $out['text'] .= '<div><label class="padding_label">'._L('Repeat').':</label><input type="password" id="new_password2" value=""/></div>';
123
                        $out['text'] .= '<br><input type="submit" value="'.($ra->isPasswordLess() ? _L('Create password') : _L('Change password')).'"></form>';
140
                        $out['text'] .= '<br><input type="submit" value="'.($ra->isPasswordLess() ? _L('Create password') : _L('Change password')).'"></form>';
124
                }
141
                }
125
        }
142
        }
126
 
143
 
-
 
144
        /**
-
 
145
         * @param array $json
-
 
146
         * @param string|null $ra_email
-
 
147
         * @param bool $nonjs
-
 
148
         * @param string $req_goto
-
 
149
         * @return bool
-
 
150
         * @throws OIDplusException
-
 
151
         */
127
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
152
        public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool {
128
                if (!$ra_email) return false;
153
                if (!$ra_email) return false;
129
                if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) return false;
154
                if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) return false;
130
 
155
 
131
                if (file_exists(__DIR__.'/img/main_icon16.png')) {
156
                if (file_exists(__DIR__.'/img/main_icon16.png')) {
132
                        $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png';
157
                        $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png';
Line 143... Line 168...
143
                );
168
                );
144
 
169
 
145
                return true;
170
                return true;
146
        }
171
        }
147
 
172
 
-
 
173
        /**
-
 
174
         * @param string $request
-
 
175
         * @return array|false
-
 
176
         */
148
        public function tree_search($request) {
177
        public function tree_search(string $request) {
149
                return false;
178
                return false;
150
        }
179
        }
151
}
180
}