內容簡介
輸入您的電子郵件地址,並透過一個魔法連結寄送一封郵件,以允許您無需密碼即可登入。
登入
僅使用電子郵件地址進行登入。
只有註冊使用者才能登入。
透過魔法連結通知的無密碼登入。
shortcode: [magic_login]
action hook: do_action( 'magic_email_send', $emails | array, true | bool ):從管理帳戶同時發送魔法連結。
感謝
這個外掛程式是基於 Passwordless Login 的修改版本。
主要更改包括增加各種過濾器勾子以及下列動作勾子的添加。
動作勾子
用於從管理畫面發送具有魔法登入功能的郵件連結,以進行多重帳戶登入。
使用此動作勾子時,應在過濾器勾子『magic_login_mail_url』中指定放置短碼 [magic_login] 的頁面 URL。
/** ==================================================
* 從管理帳戶同時發送魔法連結。
*
* @param array $emails 多個電子郵件地址。
* @param bool true 立即在傳送後通知管理畫面。
*/
do_action( 'magic_email_send', $emails, true );
過濾器勾子
/** ==================================================
* 具有郵件魔法連結 URL 的過濾器。
*
*/
add_filter( 'magic_login_mail_url', function(){ return 'url'; }, 10, 1 );
/** ==================================================
* 用於 Magic Login Mail 的當前已登入使用者連結。
*
* @param string $url URL。
* @param int $user_id 使用者 ID。
* @return $url
*/
add_filter( 'magic_login_mail_user_redirect', 'redirect_url_login_users', 10, 2 );
/** ==================================================
* 在 Magic Login Mail 跳轉後登入使用者。
*
* @param string $url URL。
* @param int $user_id 使用者 ID。
* @return $url
*/
add_filter( 'magic_login_mail_after_login_redirect', 'redirect_url_login_users', 10, 2 );
function redirect_url_login_users( $url, $user_id ) {
/* 您的程式碼 */
return $url;
}
/** ==================================================
* 具有短碼表單的訊息過濾器。
*
*/
add_filter( 'magic_login_mail_success_link_msg', function() { return '成功訊息。'; }, 10, 1 );
add_filter( 'magic_login_mail_success_login_msg', function() { return '成功登入訊息。'; }, 10, 1 );
add_filter( 'magic_login_mail_valid_errors', function() { return '郵件檢查錯誤訊息。'; }, 10, 1 );
add_filter( 'magic_login_mail_email_errors', function() { return '郵件傳送錯誤訊息。'; }, 10, 1 );
add_filter( 'magic_login_mail_invalid_token_error', function() { return '魔法令牌錯誤訊息。'; }, 10, 1 );
add_filter( 'magic_login_mail_form_label', function() { return '表單標籤訊息。'; }, 10, 1 );
/** ==================================================
* 具有短碼表單的色彩過濾器。
*
*/
add_filter( 'magic_login_mail_success_link_msg_back_color', function() { return '#e7f7d3'; }, 10, 1 );
add_filter( 'magic_login_mail_success_login_msg_back_color', function() { return '#e7f7d3'; }, 10, 1 );
add_filter( 'magic_login_mail_valid_errors_back_color', function() { return '#ffebe8'; }, 10, 1 );
外掛標籤
開發者團隊
原文外掛簡介
Enter your email address, and send you an email with a magic link or QR Code to login without a password.
Login
Login with email address only.
Only registered users can login.
Password-less login from the magic link or QR code notified in the email.
shortcode : [magic_login]
action hook : do_action( 'magic_email_send', $emails | array, true | bool ) : To send the magic link simultaneously from the management account.
QR code login on the user’s administration screen.
Thanks
This plugin is a modified version of Passwordless Login.
The main changes are the addition of various filter hooks and the addition of the following action hooks.
Action hook
This is for sending bulk e-mails with a magic link for login to multiple accounts from the management screen.
When using this action hook, the URL of the page where the shortcode [magic_login] is placed should be specified in the filter hook ‘magic_login_mail_url’.
/** ==================================================
* To send the magic link simultaneously from the management account.
*
* @param array $emails Multiple email addresses.
* @param bool true Output notifications to the management screen immediately after sending.
*/
do_action( 'magic_email_send', $emails, true );
Filter hooks
/** ==================================================
* Filter for magic link url with mail.
*
*/
add_filter( 'magic_login_mail_url', function(){ return 'url'; }, 10, 1 );
/** ==================================================
* Currently logged in user link for Magic Login Mail
*
* @param string $url URL.
* @param int $user_id User ID.
* @return $url
*/
add_filter( 'magic_login_mail_user_redirect', 'redirect_url_login_users', 10, 2 );
/** ==================================================
* Login user after redirect for Magic Login Mail
*
* @param string $url URL.
* @param int $user_id User ID.
* @return $url
*/
add_filter( 'magic_login_mail_after_login_redirect', 'redirect_url_login_users', 10, 2 );
function redirect_url_login_users( $url, $user_id ){
/* your code */
return $url;
}
/** ==================================================
* Filter for message with shortcode form.
*
*/
add_filter( 'magic_login_mail_success_link_msg', function(){ return 'Message for success.'; }, 10, 1 );
add_filter( 'magic_login_mail_success_login_msg', function(){ return 'Message for success with login.'; }, 10, 1 );
add_filter( 'magic_login_mail_valid_errors', function(){ return 'Message for mail validation error.'; }, 10, 1 );
add_filter( 'magic_login_mail_email_errors', function(){ return 'Message for sent mail error.'; }, 10, 1 );
add_filter( 'magic_login_mail_invalid_token_error', function(){ return 'Message for token error.'; }, 10, 1 );
add_filter( 'magic_login_mail_form_label', function(){ return 'Message for form label.'; }, 10, 1 );
/** ==================================================
* Filter for color with shortcode form.
*
*/
add_filter( 'magic_login_mail_success_link_msg_back_color', function(){ return '#e7f7d3'; }, 10, 1 );
add_filter( 'magic_login_mail_success_login_msg_back_color', function(){ return '#e7f7d3'; }, 10, 1 );
add_filter( 'magic_login_mail_valid_errors_back_color', function(){ return '#ffebe8'; }, 10, 1 );
add_filter( 'magic_login_mail_email_errors_back_color', function(){ return '#ffebe8'; }, 10, 1 );
add_filter( 'magic_login_mail_invalid_token_error_back_color', function(){ return '#ffebe8'; }, 10, 1 );
/** ==================================================
* Filter for input text size.
*
*/
add_filter( 'magic_login_mail_input_size', function(){ return 17; }, 10, 1 );
/** ==================================================
* Filter for class name.
*
*/
add_filter( 'magic_login_mail_notice_class_name', function(){ return 'mynotice'; }, 10, 1 );
add_filter( 'magic_login_mail_form_class_name', function(){ return 'myform'; }, 10, 1 );
add_filter( 'magic_login_mail_label_class_name', function(){ return 'mylabel'; }, 10, 1 );
add_filter( 'magic_login_mail_input_class_name', function(){ return 'myinput'; }, 10, 1 );
add_filter( 'magic_login_mail_submit_class_name', function(){ return 'mysubmit'; }, 10, 1 );
/** ==================================================
* Filter for message with mail subject.
*
*/
add_filter( 'magic_login_mail_subject', function(){ return 'subject'; }, 10, 1 );
/** ==================================================
* Filter for message with mail.
*
* @param string $message message.
* @param string $url url.
* @param string $exp_date_time expiration date and time.
*/
add_filter(
'magic_login_mail_message',
function( $message, $url, $exp_date_time ) {
$message .= '
' . 'You may only log in once using the link above.';
return $message;
},
10,
3
);
/** ==================================================
* Filter for login expiration.
*
*/
add_filter( 'magic_login_mail_expiration', function(){ return 10; }, 10, 1 );
