Rev 1267 | Rev 1283 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1267 | Rev 1282 | ||
---|---|---|---|
Line 93... | Line 93... | ||
93 | return array("status" => 0); |
93 | return array("status" => 0); |
94 | } else { |
94 | } else { |
95 | OIDplus::logger()->log("V2:[INFO]RA(%1)+RA(%2)", "Requested email address change from '%1' to '%2'", $old_email, $new_email); |
95 | OIDplus::logger()->log("V2:[INFO]RA(%1)+RA(%2)", "Requested email address change from '%1' to '%2'", $old_email, $new_email); |
96 | 96 | ||
97 | $timestamp = time(); |
97 | $timestamp = time(); |
98 | $activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:activate_new_ra_email$'.$old_email.'$'.$new_email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('activate_new_ra_email;'.$old_email.';'.$new_email.';'.$timestamp)); |
98 | $activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:activate_new_ra_email$'.$old_email.'$'.$new_email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('5ef24124-f4fb-11ed-b67e-3c4a92df8582:'.$old_email.'/'.$new_email.'/'.$timestamp)); |
99 | 99 | ||
100 | $message = file_get_contents(__DIR__ . '/change_request_email.tpl'); |
100 | $message = file_get_contents(__DIR__ . '/change_request_email.tpl'); |
101 | $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL), $message); |
101 | $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL), $message); |
102 | $message = str_replace('{{SYSTEM_TITLE}}', OIDplus::config()->getValue('system_title'), $message); |
102 | $message = str_replace('{{SYSTEM_TITLE}}', OIDplus::config()->getValue('system_title'), $message); |
103 | $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message); |
103 | $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message); |
Line 133... | Line 133... | ||
133 | $ra = new OIDplusRA($old_email); |
133 | $ra = new OIDplusRA($old_email); |
134 | if ($ra->isPasswordLess() && !OIDplus::authUtils()->isAdminLoggedIn()) { |
134 | if ($ra->isPasswordLess() && !OIDplus::authUtils()->isAdminLoggedIn()) { |
135 | throw new OIDplusException(_L('E-Mail-Address cannot be changed because this user does not have a password')); |
135 | throw new OIDplusException(_L('E-Mail-Address cannot be changed because this user does not have a password')); |
136 | } |
136 | } |
137 | 137 | ||
138 | if (!OIDplus::authUtils()->validateAuthKey('activate_new_ra_email;'.$old_email.';'.$new_email.';'.$timestamp, $auth)) { |
138 | if (!OIDplus::authUtils()->validateAuthKey('5ef24124-f4fb-11ed-b67e-3c4a92df8582:'.$old_email.'/'.$new_email.'/'.$timestamp, $auth)) { |
139 | throw new OIDplusException(_L('Invalid auth key')); |
139 | throw new OIDplusException(_L('Invalid auth key')); |
140 | } |
140 | } |
141 | 141 | ||
142 | if ((OIDplus::config()->getValue('max_ra_email_change_time') > 0) && (time()-$timestamp > OIDplus::config()->getValue('max_ra_email_change_time'))) { |
142 | if ((OIDplus::config()->getValue('max_ra_email_change_time') > 0) && (time()-$timestamp > OIDplus::config()->getValue('max_ra_email_change_time'))) { |
143 | throw new OIDplusException(_L('Activation link expired!')); |
143 | throw new OIDplusException(_L('Activation link expired!')); |