diff --git a/include/class-PageLogin.php b/include/class-PageLogin.php index 7aa1fee..14a0ffa 100644 --- a/include/class-PageLogin.php +++ b/include/class-PageLogin.php @@ -1,31 +1,48 @@ setTitle( __( "Login" ) ); // check if we should do the login - if( is_action( 'do-login' ) ) { + if( $this->isLoginFormSubmitted() ) { - // process the login form + // process the user_uid and the user_password sent via POST login(); } + // eventually go to the homepage if logged-in + if( is_logged() ) { + http_redirect( '', 303 ); + } + } + + /** + * Check if the login form was submitted + * + * @return boolean + */ + public function isLoginFormSubmitted() { + return is_action( 'do-login' ); + } + + /** + * Check if the login failed + * + * @return boolean + */ + public function isLoginFormFailed() { + return $this->isLoginFormSubmitted() && !is_logged(); } } diff --git a/www/login.php b/www/login.php index bafab2d..6e5bb2a 100644 --- a/www/login.php +++ b/www/login.php @@ -1,36 +1,44 @@ printHeader(); ?> + + isLoginFormSubmitted() ): ?> +
+

+
+ + +


- +


- +

printFooter();