Skip to content

Commit d76023f

Browse files
committed
Use safe redirect & exit on template redirects
1 parent 00d6a30 commit d76023f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plugins/bcc-login/includes/class-bcc-login-visibility.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ function on_template_redirect() {
178178
// Initiate new login if session has expired
179179
if ( is_user_logged_in() && !$session_is_valid ) {
180180
$this->_client->end_login();
181-
wp_redirect( wp_login_url($visited_url) );
182-
return;
181+
wp_safe_redirect( wp_login_url($visited_url) );
182+
exit;
183183
}
184184

185185
// Show everything to editors
@@ -210,8 +210,8 @@ function on_template_redirect() {
210210
if ( is_user_logged_in() ) {
211211
return $this->not_allowed_to_view_page($visited_url);
212212
} else {
213-
wp_redirect( wp_login_url($visited_url) );
214-
return;
213+
wp_safe_redirect( wp_login_url($visited_url) );
214+
exit;
215215
}
216216
}
217217

@@ -228,8 +228,8 @@ function on_template_redirect() {
228228
}
229229

230230
if ( !is_user_logged_in() ) {
231-
wp_redirect( wp_login_url($visited_url) );
232-
return;
231+
wp_safe_redirect( wp_login_url($visited_url) );
232+
exit;
233233
}
234234

235235
$user_groups = $this->get_current_user_groups();

0 commit comments

Comments
 (0)