取消替换登录界面,改为再源程序登录界面注入登录按钮
This commit is contained in:
parent
68ad74a645
commit
c229a0cfe2
Binary file not shown.
|
@ -26,8 +26,11 @@ class QuickAuthLogin_Plugin implements Typecho_Plugin_Interface {
|
||||||
$info = self::updateDb();
|
$info = self::updateDb();
|
||||||
|
|
||||||
Typecho_Plugin::factory('admin/menu.php')-> navBar = array(__class__, 'render');
|
Typecho_Plugin::factory('admin/menu.php')-> navBar = array(__class__, 'render');
|
||||||
Typecho_Plugin::factory('admin/header.php')-> header = array(__class__,'login');
|
|
||||||
Typecho_Plugin::factory('Widget_User')-> loginSucceed = array(__class__,'afterlogin');
|
Typecho_Plugin::factory('Widget_User')-> loginSucceed = array(__class__,'afterlogin');
|
||||||
|
Typecho_Plugin::factory('admin/footer.php')->end = array(__class__, 'render_footer');
|
||||||
|
|
||||||
|
|
||||||
|
Helper::addPanel(1, 'QuickAuthLogin/views/authbind.php', '微信账号绑定', '微信账号绑定', 'subscriber');
|
||||||
|
|
||||||
Helper::addRoute('bind',__TYPECHO_ADMIN_DIR__.'QuickAuthLogin/bind','QuickAuthLogin_Action','bind');
|
Helper::addRoute('bind',__TYPECHO_ADMIN_DIR__.'QuickAuthLogin/bind','QuickAuthLogin_Action','bind');
|
||||||
Helper::addRoute('login',__TYPECHO_ADMIN_DIR__.'QuickAuthLogin/login','QuickAuthLogin_Action','login');
|
Helper::addRoute('login',__TYPECHO_ADMIN_DIR__.'QuickAuthLogin/login','QuickAuthLogin_Action','login');
|
||||||
|
@ -77,6 +80,10 @@ class QuickAuthLogin_Plugin implements Typecho_Plugin_Interface {
|
||||||
ALTER TABLE `{$prefix}users` DROP COLUMN `qa_avatar`;
|
ALTER TABLE `{$prefix}users` DROP COLUMN `qa_avatar`;
|
||||||
";
|
";
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
|
|
||||||
|
|
||||||
|
Helper::removePanel(1, 'QuickAuthLogin/views/authbind.php');
|
||||||
|
|
||||||
|
|
||||||
return "数据表删除字段成功!";
|
return "数据表删除字段成功!";
|
||||||
}
|
}
|
||||||
|
@ -170,6 +177,32 @@ class QuickAuthLogin_Plugin implements Typecho_Plugin_Interface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function render_footer(){
|
||||||
|
$options = self::getoptions();
|
||||||
|
if (!Typecho_Widget::widget('Widget_User')->hasLogin()){
|
||||||
|
|
||||||
|
|
||||||
|
echo '<script>
|
||||||
|
$(".submit").append("<button type=\\"button\\" style=\\"background: #2a0; margin-top:5px; color:white;\\" class=\\"btn btn-l w-100\\" onClick=\\"QuickAuthLogin()\\">微信登陆</button>"
|
||||||
|
);';
|
||||||
|
|
||||||
|
if(empty($options->qauth_app_key))
|
||||||
|
{
|
||||||
|
echo 'function QuickAuthLogin(){
|
||||||
|
alert("使用微信登陆需要先配置QuickAuth插件的AppKey和UserSecret");
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo 'function QuickAuthLogin(){
|
||||||
|
var iTop = (window.screen.availHeight - 30 - 600) / 2;
|
||||||
|
var iLeft = (window.screen.availWidth - 10 - 500) / 2;
|
||||||
|
window.open ("'.$options->qauth_api.'/qrconnect?appkey='.$options->qauth_app_key.'&state=login&popup=true","QuickAuth登录","width=500,height=600,top="+iTop+",left="+iLeft);
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
echo '</script>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function render(){
|
public static function render(){
|
||||||
$options = self::getoptions();
|
$options = self::getoptions();
|
||||||
if($options->users){
|
if($options->users){
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
# QuickAuthLogin
|
||||||
|
|
||||||
|
基于[QuickAuth](https://qauth.cn)扫码登录平台开发的Typecho微信扫码登录插件
|
||||||
|
|
||||||
|
## 起始
|
||||||
|
|
||||||
|
本插件是基于 QuickAuth 开发的 插件,使用前需要进入[QuickAuth平台](https://qauth.cn)注册配置自己的应用
|
||||||
|
|
||||||
|
如需修改插件或开发自己的接入项目,请参考 [QuickAuth接入文档](https://qauth.cn/doc/index.html)
|
||||||
|
|
||||||
|
插件地址:[https://github.com/mr-wixy/QuickAuthLogin](https://github.com/mr-wixy/QuickAuthLogin)
|
||||||
|
|
||||||
|
(请勿与其它同类插件同时启用,以免互相影响)
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
|
||||||
|
第 1 步:下载本插件,解压,放到 `usr/plugins/` 目录中;
|
||||||
|
|
||||||
|
第 2 步:文件夹名改为 `QuickAuthLogin`;
|
||||||
|
|
||||||
|
第 3 步:登录管理后台,激活插件;
|
||||||
|
|
||||||
|
第 4 步:登录QuickAuth网站创建接入应用;
|
||||||
|
|
||||||
|
![](https://cdn.wixy.cn/blog-picture/blog-picture20220127160420.png)
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
第 5 步:填写应用的基本信息(注意:此时可以获取到AppKey,回调地址请填写自己博客的域名+/index.php/admin/QuickAuthLogin/wechatlogin 此处必须为https)
|
||||||
|
|
||||||
|
![](https://cdn.wixy.cn/blog-picture/blog-picture20220127160707.png)
|
||||||
|
|
||||||
|
第 6 步:发布应用;
|
||||||
|
|
||||||
|
![发布应用](https://cdn.wixy.cn/blog-picture/blog-picture20220127161055.png)
|
||||||
|
|
||||||
|
第 7 步:[获取](https://qauth.cn/config/secret)UserSecretKey;
|
||||||
|
|
||||||
|
![](https://cdn.wixy.cn/blog-picture/blog-picture20220127161157.png)
|
||||||
|
|
||||||
|
第 8 步:进入博客插件后台配置AppKey和UserSecret;
|
||||||
|
|
||||||
|
![](https://cdn.wixy.cn/blog-picture/20220127161859.png)
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
## 重要说明
|
||||||
|
|
||||||
|
1. QuickAuthApi 默认配置,正常情况下无需修改(除非QuickAuth网站接口地址改了)
|
||||||
|
2. 账户密码登录默认开启,如需关闭,请确保账号已经绑定微信,否则将无法正常登录后台;如果出现这种情况,请重装插件解决!
|
||||||
|
3. 允许未绑定微信账号扫码登录开启后,未绑定的微信扫码则会自动注册账号
|
||||||
|
4. 非管理员启用选项开启后会在导航栏增加微信账号绑定入口
|
||||||
|
|
||||||
|
## 与我联系
|
||||||
|
|
||||||
|
作者:wixy
|
||||||
|
|
||||||
|
如果有任何意见或发现任何BUG请联系我
|
||||||
|
|
||||||
|
博客:[https://blog.wixy.cn/](https://blog.wixy.cn/)
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once __TYPECHO_ROOT_DIR__.__TYPECHO_ADMIN_DIR__.'common.php';
|
require_once __TYPECHO_ROOT_DIR__.__TYPECHO_ADMIN_DIR__.'common.php';
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ if($group != 'administrator' && !$option->users){ //非管理员且[非管理员
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="renderer" content="webkit">
|
<meta name="renderer" content="webkit">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>QuickAuthLogin - 扫描登录授权绑定</title>
|
<title>QuickAuthLogin - 扫码登录授权绑定</title>
|
||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<link rel="stylesheet" href="<?=__TYPECHO_ADMIN_DIR__?>css/normalize.css?v=17.10.30">
|
<link rel="stylesheet" href="<?=__TYPECHO_ADMIN_DIR__?>css/normalize.css?v=17.10.30">
|
||||||
<link rel="stylesheet" href="<?=__TYPECHO_ADMIN_DIR__?>css/grid.css?v=17.10.30">
|
<link rel="stylesheet" href="<?=__TYPECHO_ADMIN_DIR__?>css/grid.css?v=17.10.30">
|
||||||
|
|
Loading…
Reference in New Issue