Compare commits

...

3 Commits
v0.9.0 ... main

Author SHA1 Message Date
wixy 16e5c2c5ff modify version 2022-04-28 08:40:37 +08:00
wixy a518a83e7b 0.9.3版本
支持自定义登录按钮调用方法
2022-04-27 23:27:53 +08:00
wixy ab0cf3ae50 v0.9.2 版本更新 2022-04-07 15:59:26 +08:00
2 changed files with 49 additions and 16 deletions

View File

@ -1,13 +1,15 @@
<?php
/*
Plugin Name: QuickAuthLogin
Plugin URI: https://github.com/mr-wixy/QuickAuthLogin-WP
Plugin URI: https://gitee.com/wixy/QuickAuthLogin-WP
Description: QuickAuth微信扫码登陆插件
Version: 0.9.0
Version: 0.9.3
Author: wixy
Author URI: https://blog.wixy.cn/
*/
const PLUGIN_VERSION = '0.9.3';
//自定义登录按钮
function custom_login_button() {
echo '<button class="button button-primary button-large" style="color:#fff;background: #2a0; float: right; margin: 18px 0 5px 10px; min-height: 32px;" href="" type="button" onClick="openLogin()">微信登陆</button><br />';
@ -41,6 +43,7 @@ function custom_html() {
}
}
add_action('login_footer', 'custom_html');
add_action('wp_footer', 'custom_html');
//回调接口定义
add_action( 'rest_api_init', function () {
@ -48,8 +51,24 @@ add_action( 'rest_api_init', function () {
'methods' => 'GET',
'callback' => 'qauth_login',
) );
register_rest_route( 'wp/v2', '/qauth_login/ping', array(
'methods' => 'GET',
'callback' => 'ping',
) );
} );
function ping(){
$data = [
"code" => 0,
"msg" => "pong",
"data" => [
"name" => "QuickAuthLogin For WordPress",
"version" => PLUGIN_VERSION
]
];
echo json_encode($data);
}
function qauth_login() {
$code = $_GET['code'];
$state = $_GET['state'];
@ -265,8 +284,7 @@ function qauth_options_page_html() {
<li><label class="typecho-label">使用说明:</label>
<ol>
<li><p class="description">登陆 <a target="_blank" href="https://qauth.cn">QuickAuth</a>网站</p></li>
<li><p class="description"><a target="_blank" href="https://qauth.cn/app">创建应用</a> 并填写相关信息回调地址请填写https://博客域名/index.php/wp-json/wp/v2/qauth_login</p></li>
<li><p class="description"><a target="_blank" href="https://qauth.cn/app">发布</a> 应用</p></li>
<li><p class="description"><a target="_blank" href="https://qauth.cn/app">创建应用</a> 填写相关信息 保存并发布</p></li>
<li><p class="description">在此页面中配置 AppKey和UserSecret</p></li>
</ol>
</li>

View File

@ -4,15 +4,34 @@
基于[QuickAuth](https://qauth.cn)扫码登录平台开发的WordPress微信扫码登录插件
### 更新记录
#### 2022/04/27 v0.9.3
新增全局注入登录框调用方法openLogin()可自定义登录按钮调出微信扫码登录界面只需要在按钮添加onclick事件调用openLogin()方法就可以了
例如
```
<button onclick="openLogin();">微信登陆</button>
```
#### 2022/03/31 v0.9.2
1. 支持QuickAuth平台测试功能可测试插件是否安装成功
2. 更新接入教程
## 起始
本插件是基于 QuickAuth 开发的 插件,使用前需要进入[QuickAuth平台](https://qauth.cn)注册配置自己的应用
如需修改插件或开发自己的接入项目,请参考 [QuickAuth接入文档](https://qauth.cn/doc/index.html)
插件地址:[https://github.com/mr-wixy/QuickAuthLogin-WP](https://github.com/mr-wixy/QuickAuthLogin-WP)
插件地址:
下载地址:[QuickAuthLogin.zip][1]
Gitee: [https://gitee.com/wixy/QuickAuthLogin-WP](https://gitee.com/wixy/QuickAuthLogin-WP)
Github: [https://github.com/mr-wixy/QuickAuthLogin-WP](https://github.com/mr-wixy/QuickAuthLogin-WP)
(请勿与其它同类插件同时启用,以免互相影响)
@ -24,25 +43,21 @@
第 3 步登录QuickAuth网站创建接入应用
![](https://cdn.wixy.cn/blog-picture/blog-picture20220127160420.png)
![创建接入应用](https://cdn.wixy.cn/blog-picture/20220407155243.png)
第 4 步:填写应用的基本信息注意此时可以获取到AppKey回调地址请填写自己博客的域名+/index.php/wp-json/wp/v2/qauth_login 此处必须为https
第 4 步:发布应用;
![](https://cdn.wixy.cn/blog-picture/20220207150311.png)
![发布应用](https://cdn.wixy.cn/blog-picture/20220407133237.png)
第 5 步:发布应用;
![发布应用](https://cdn.wixy.cn/blog-picture/blog-picture20220127161055.png)
第 6 步:[获取](https://qauth.cn/config/secret)UserSecretKey
第 5 步:[获取](https://qauth.cn/config/secret)UserSecretKey
![](https://cdn.wixy.cn/blog-picture/blog-picture20220127161157.png)
7进入博客插件后台配置AppKey和UserSecret
第 6 步进入博客插件后台配置AppKey和UserSecret
![](https://cdn.wixy.cn/blog-picture/20220207145540.png)
8 步:进入博客后台绑定管理员微信账号;
7 步:进入博客后台绑定管理员微信账号;
![](https://cdn.wixy.cn/blog-picture/20220207151735.png)