Marc1205
Forum Replies Created
-
Sorry for asking. Found the solution in the docs.
https://github.com/benhuson/password-protected/wiki/password_protected_theme_file
Thanks,
MarcForum: Plugins
In reply to: [Passwordless Login] Login failsHi Fritz,
found the mistake in my Custom code. There was a problem with another Plugin to extend the WordPress Usersettings. Everytime a user tried to login they ended up in an infinite redirect loop xD. The Other Problem was that I used the passwordless Login for all Users, so there was no default WordPress Login. Toghether with my User privacy Settings the Admin could Not Login via passwordless Login.
Best,
MarcForum: Plugins
In reply to: [Passwordless Login] URL after LoginHi Steven,
this may not be most elegant way, but I achieved this by just adding the URL I want the user to see after login to the redirect in the “passwordless_login.php file./** * Automatically logs in a user with the correct nonce * * @since v.1.0 * * @return string */ add_action( 'init', 'wpa_autologin_via_url' ); function wpa_autologin_via_url(){ if( isset( $_GET['token'] ) && isset( $_GET['uid'] ) && isset( $_GET['nonce'] ) ){ $uid = sanitize_key( $_GET['uid'] ); $token = sanitize_key( $_REQUEST['token'] ); $nonce = sanitize_key( $_REQUEST['nonce'] ); $hash_meta = get_user_meta( $uid, 'wpa_' . $uid, true); $hash_meta_expiration = get_user_meta( $uid, 'wpa_' . $uid . '_expiration', true); $arr_params = array( 'uid', 'token', 'nonce' ); $current_page_url = remove_query_arg( $arr_params, wpa_curpageurl() ); require_once( ABSPATH . 'wp-includes/class-phpass.php'); $wp_hasher = new PasswordHash(8, TRUE); $time = time(); if ( ! $wp_hasher->CheckPassword($token . $hash_meta_expiration, $hash_meta) || $hash_meta_expiration < $time || ! wp_verify_nonce( $nonce, 'wpa_passwordless_login_request' ) ){ wp_redirect( $current_page_url . '?wpa_error_token=true' ); exit; } else { wp_set_auth_cookie( $uid ); delete_user_meta($uid, 'wpa_' . $uid ); delete_user_meta($uid, 'wpa_' . $uid . '_expiration'); $total_logins = get_option( 'wpa_total_logins', 0); update_option( 'wpa_total_logins', $total_logins + 1); //Old redirect //wp_redirect( $current_page_url ); //Custom redirect wp_redirect( 'https://YOUR-LANDING-PAGE.COM' ); exit; } } }
A better way would be to write a small plugin overwriting the existing redirect, so you don′t get in trouble when updating the Plugin.
Best,
MarcForum: Plugins
In reply to: [Passwordless Login] Login failsHey Teodor,
Thanks for your reply. I customized your Plugin a bit, found the mistake I′ve made and resolved the login problem.
Thanks,
MarcForum: Plugins
In reply to: [Passwordless Login] Change LanguageThanks for your help, works fine!