Subversion Repositories oidplus

Rev

Rev 1283 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1283 Rev 1293
Line 24... Line 24...
24
// phpcs:enable PSR1.Files.SideEffects
24
// phpcs:enable PSR1.Files.SideEffects
25
 
25
 
26
class OIDplusPageRaChangeEMail extends OIDplusPagePluginRa {
26
class OIDplusPageRaChangeEMail extends OIDplusPagePluginRa {
27
 
27
 
28
        /**
28
        /**
29
         * @param string $actionID
-
 
30
         * @param array $params
29
         * @param array $params
31
         * @return array
30
         * @return array
32
         * @throws OIDplusException
31
         * @throws OIDplusException
33
         * @throws OIDplusMailException
32
         * @throws OIDplusMailException
34
         */
33
         */
35
        public function action(string $actionID, array $params): array {
34
        private function action_Request(array $params): array {
36
                if ($actionID == 'change_ra_email') {
-
 
37
                        if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()->isAdminLoggedIn()) {
35
                if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()->isAdminLoggedIn()) {
38
                                throw new OIDplusException(_L('This functionality has been disabled by the administrator.'));
36
                        throw new OIDplusException(_L('This functionality has been disabled by the administrator.'));
39
                        }
37
                }
40
 
38
 
41
                        _CheckParamExists($params, 'old_email');
39
                _CheckParamExists($params, 'old_email');
Line 107... Line 105...
107
 
105
 
108
                                return array("status" => 0);
106
                        return array("status" => 0);
109
                        }
107
                }
110
                }
108
        }
111
 
109
 
-
 
110
        /**
-
 
111
         * @param array $params
-
 
112
         * @return array
-
 
113
         * @throws OIDplusException
-
 
114
         * @throws OIDplusMailException
-
 
115
         */
112
                else if ($actionID == 'activate_new_ra_email') {
116
        private function action_Activate(array $params): array {
113
                        if (!OIDplus::config()->getValue('allow_ra_email_change')) {
117
                if (!OIDplus::config()->getValue('allow_ra_email_change')) {
114
                                throw new OIDplusException(_L('This functionality has been disabled by the administrator.'));
118
                        throw new OIDplusException(_L('This functionality has been disabled by the administrator.'));
115
                        }
119
                }
116
 
120
 
117
                        _CheckParamExists($params, 'old_email');
121
                _CheckParamExists($params, 'old_email');
Line 179... Line 183...
179
                        $message = str_replace('{{OLD_EMAIL}}', $old_email, $message);
183
                $message = str_replace('{{OLD_EMAIL}}', $old_email, $message);
180
                        $message = str_replace('{{NEW_EMAIL}}', $new_email, $message);
184
                $message = str_replace('{{NEW_EMAIL}}', $new_email, $message);
181
                        OIDplus::mailUtils()->sendMail($old_email, OIDplus::config()->getValue('system_title').' - eMail address changed', $message);
185
                OIDplus::mailUtils()->sendMail($old_email, OIDplus::config()->getValue('system_title').' - eMail address changed', $message);
182
 
186
 
183
                        return array("status" => 0);
187
                return array("status" => 0);
-
 
188
        }
-
 
189
 
-
 
190
        /**
-
 
191
         * @param string $actionID
-
 
192
         * @param array $params
-
 
193
         * @return array
-
 
194
         * @throws OIDplusException
-
 
195
         * @throws OIDplusMailException
-
 
196
         */
-
 
197
        public function action(string $actionID, array $params): array {
-
 
198
                if ($actionID == 'change_ra_email') {
-
 
199
                        return $this->action_Request($params);
-
 
200
                } else if ($actionID == 'activate_new_ra_email') {
-
 
201
                        return $this->action_Activate($params);
184
                } else {
202
                } else {
185
                        return parent::action($actionID, $params);
203
                        return parent::action($actionID, $params);
186
                }
204
                }
187
        }
205
        }
188
 
206