This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).
wget 'https://sme10.lists2.roe3.org/kodbox/plugins/oauth/static/oauth/bind.js'
ClassBase.define({
init:function(){
this.request = new kodApi.request({parent: this});
},
// 绑定
bind:function(type,action,client){
action = action == undefined ? 'login' : action;
client = client == undefined ? 1 : client;
if (this.notifyTips) {
return Tips.tips(LNG['oauth.main.loginRpt'], 'warning');
}
// 判断是否在微信浏览器
this.platform = $.browserIS.weixin ? 'mp' : 'open'; // 公众平台or开放平台
var self = this, tips = false;
var param = {method: 'oauth', type: type, action: action, client: client, state: this.platform};
if(type != 'weixin'){tips = Tips.loadingMask(false, LNG['oauth.main.loading']);}
this.request.requestSend('plugin/oauth/bind', param, function(result){
if(tips){tips.close();}
if(!result.code) {
Tips.tips(result.data, false,5000);
return false;
}
self.bindSubmit(type, result.data, result.info);
});
},
// 解绑
unbind: function (type, parent) {
var self = this;
$.dialog({
id: 'dialog-unbind-confirm',
fixed: true,//不跟随页面滚动
// icon: 'question',
padding: 30,
width: 250,
lock: true,
background: "#000",
opacity: 0.2,
content: LNG['user.ifUnbind'],
ok: function () {
self.request.requestSend('plugin/oauth/bind', {method: 'unbind', type: type}, function(result){
Tips.tips(result.data, result.code);
if (!result.code) return;
parent.$("#" + type + ">span:nth-child(2), #" + type + ">span:nth-child(3)").remove();
var html = '<span class="w50"><a class="bind" href="javascript:void(0)">' + LNG['user.clickBind'] + '</a></span>';
parent.$("#" + type).append(html);
});
},
cancel: true
});
},
// (第三方)账号绑定提交
bindSubmit: function (type,param,appid) {
appid = appid || '';
var directUrl = G.system.settings.kodApiServer + 'plugin/platform/&' + param;
switch (type) {
case 'weixin':
this.weixinBind(directUrl, appid);
break;
case 'qq':
case 'github':
case 'google':
case 'facebook':
if (type != 'qq') this.showTips(type);
window.top.location.href = directUrl;
break;
default: break;
}
},
weixinBind: function (url, appid) { // 微信绑定
// 微信内打开,使用公众号接口授权登录
if(this.platform == 'mp') {
var param = [
'appid='+appid,
'redirect_uri='+urlEncode(url),
'response_type=code',
'scope=snsapi_userinfo',
'state='+this.platform
];
window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?'+param.join('&')+'#wechat_redirect';
return false;
}
// 微信外,使用开放平台接口授权
var connect = _.startsWith(G.lang, 'zh') ? '' : ' ';
$.dialog({
id: 'bindlogin',
title: LNG['user.bind'] + connect + LNG['common.wechat'],
ico: '',
width: 300,
height: 400, // 300
lock: true,
background: '#fff',
opacity: 0.1,
resize: true,
fixed: true,
content: '<div id="wxqrcode"></div>'
});
requireAsync("//res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js", function(){
new WxLogin({
self_redirect: true,
id: "wxqrcode",
appid: appid,
scope: "snsapi_login",
redirect_uri: urlEncode(url),
state: "",
style: "",
href: ""
});
});
},
// 跳转加载慢,显示提示信息
showTips: function(type){
var self = this;
var tips = _.replace(LNG['oauth.main.loadTips'], '[0]', _.upperFirst(type));
this.notifyTips = Tips.notify({
icon:"loading",
title:LNG['common.tips'],
content:"<div style='line-height:20px;'>"+tips+"(https://"+type+".com)</div>",
onClose:function(){
self.notifyTips = null;
window.top.location.reload();
return false;
}
});
},
});
wget 'https://sme10.lists2.roe3.org/kodbox/plugins/oauth/static/oauth/index.html'
<!DOCTYPE html>
<head>
<title><?php echo LNG('oauth.main.pageTitle');?></title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="theme-color" content="#d89000">
<link rel="icon" href="./static/images/icon/fav.png">
<script>var kodSdkConfig = {api:'<?php echo APP_HOST;?>'};</script>
<?php $this->link('app/dist/sdk.js','static');?>
<?php $this->link('style/lib/font-icon/style.css','static');?>
<style>
body {width: 100%;height: 100%;position: fixed;top: 0;left: 0;bottom: 0;right: 0;margin:0px;padding:0px;}
body.is-not-wap{background: #fffcfc;}
body:after {
position: absolute;top: 0;right: 0;bottom: 0;left: 0;z-index: 100;
background: url("<?php echo STATIC_PATH.'images/common/loading-page.gif';?>");
margin: auto;width: 72px;height: 72px;
content: "";text-align: center;transition: all 0.5s;
background-color: #eee;background-size: 100% 100%;background-repeat: no-repeat;
border-radius: 8px;box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}
body.page-loaded:after {visibility: hidden;opacity: 0;}
body #app {height: 100%;display: -webkit-flex;justify-content: center;align-items: center;}
/* body .bind-box {text-align: center; margin-top: -100px;} */
body .bind-box {text-align: center;}
body.is-not-wap .bind-box {
width: 400px;
border: 1px solid #ededed;
border-radius: 4px;
padding: 140px 0px;
background: #fff;
margin-top: 0px;
}
body .bind-box .title {color: red;font-size: 16px;}
body .bind-box .msg {color: #747474;font-size: 13px;margin-bottom: 20px;}
/* body .bind-box img {width: 120px;height: 120px;} */
body .bind-box img {width: 100px;height: 100px;}
body .bind-box .img-box p {margin-top: 10px;font-size: 12px;color: #949494;}
body .bind-box .img-box .loading {margin-top: 150px;font-size: 14px;color: #949494;font-style: italic;}
body .bind-box .back-home{margin: 0px; font-size: 13px;display: none;}
body .bind-box .back-home a{text-decoration: none; color: #1890ff;}
@media (max-width: 560px) {
body.is-not-wap{background: #fff;}
body.is-not-wap .bind-box {
width: 100%;
border: none;
/* margin-top: -100px; */
padding: 0px;
}
}
</style>
<script>
var BASE_URL = "<?php echo $this->pluginHost.'static/';?>";
var STATIC_PATH = "<?php echo STATIC_PATH;?>";
var BASE_URL_API = "<?php echo $this->pluginApi;?>";
</script>
</head>
<body>
<div id="app">
<div class="bind-box">
<p class="title"></p>
<p class="msg"></p>
<div class="img-box">
<div class="loading">Loading...</div>
</div>
<p class="back-home"><a href="./"><?php echo LNG('oauth.main.backHome');?></a></p>
</div>
</div>
<script>
$(function () {
// 获取当前url参数
var getUrlParams = function () {
var data = {};
var query = window.location.search.substring(1).split('&'); // 先解码导致data参数({})异常
for(var i in query) {
var item = query[i];
var idx = item.indexOf('=');
if (idx > 0) {
var key = item.slice(0, idx);
var value = item.slice(idx + 1);
data[key] = urlDecode(value);
}
}
return data;
}
// 解析bindApi页面返回数据
var bindData = function (result) {
if (!result.code) {
return {
title: 'An error occurred',
avatar: BASE_URL + 'images/error.png',
msg: result.data,
desc: '',
}
}
if (!result.data.success) {
result.data.avatar = BASE_URL + 'images/error.png';
}
var msgArr = result.data.msg.split(";");
result.data.msg = msgArr[0];
result.data.desc = msgArr[1] || '';
return result.data;
}
// 页面跳转
var bindAfter = function (type, url, client = false, bind = false) {
var time = type != 'weixin' ? 3000 : 1000;
if (client && bind) {
return setTimeout(function () {
window.parent.location.href = url;
}, time);
}
if (type != 'weixin') {
return setTimeout(function () { location.href = url; }, time);
}
if (client) {
window.parent.location.href = url;
} else {
if (!window.parent.artDialog.list["bindlogin"]) {
return setTimeout(function () { location.href = url; }, time);
}
window.parent.location.reload();
}
return setTimeout(function () {
window.parent.artDialog.list["bindlogin"].close();
}, time);
}
// ajax请求回调
var ajaxAfter = function(result){
// 1.页面信息
$('body').addClass('page-loaded'+(!$.isWap ? ' is-not-wap' : ''));
var data = bindData(result);
$(".bind-box .title").text(data.title);
$(".bind-box .msg").text(data.msg);
var $box = $(".bind-box .img-box").html('<img src=""><p></p>');
$box.find('img').attr({src: data.avatar});
$box.find('p').text(data.desc);
if (result.code && result.data.success) {
$(".bind-box img").attr({onerror: 'this.src="'+STATIC_PATH+'images/common/default-avata.png'+'"'}).css('border-radius', '60px');
$(".bind-box img").next('p').html(htmlEncode(data.name));
}
// 2.页面跳转
var data = result.data;
// 绑定异常时不自动跳转
if (!data.success) {
if (data.type != 'weixin') {
var hash = data.client ? './' : './#setting/user/account';
$(".bind-box .back-home a").attr('href', hash);
$(".bind-box .back-home").show();
}
return false; // weixin弹窗保持
}
// 后端
if (!data.client) {
var url = './#setting/user/account';
return bindAfter(data.type, url);
}
// 前端-已绑定(进入主页面)
bindAfter(data.type, './', true, data.bind);
}
// 回调请求
$.ajax({
url: BASE_URL_API + 'bind&method=bindApi',
data: getUrlParams(),
dataType: 'json',
success: function (result) {
ajaxAfter(result);
},
error: function(xhr,status,error){
var result = {code: false, data: error};
ajaxAfter(result);
}
});
})
</script>
</body>
</html>
wget 'https://sme10.lists2.roe3.org/kodbox/plugins/oauth/static/oauth/login.js'
ClassBase.define({
init: function (param) {
this.loginWith = _.split(param.load.loginWith, ',');
if (!this.loginWith) return; // 登录项为空,直接返回
this.thirdItems = param.load.thirdItems;
this.Bind = new param.Bind();
this.initView();
},
initView: function(){
var self = this;
var opt = '';
_.each(this.loginWith, function(type){
var name = self.thirdItems[type];
var icon = type == 'weixin' ? 'wechat' : type;
var title = _.replace(LNG['oauth.main.loginWith'], '[0]', name);
// opt += '<span class="box-'+type+' third-item" data-type='+type+' title="'+title+'" title-timeout="200"></span>';
opt += '<i class="font-icon ri-'+icon+'-fill third-item with-color" data-type='+type+' title="'+title+'" title-timeout="200"></i>';
});
var html = '<div class="text-muted text-center more-login-area">\
<span class="more-login-words">'+LNG['user.moreLogin']+'</span>\
</div>\
<div class="login-third-box">'+opt+'</div>';
var $form = this.$('.login-form form');
if ($form.children('.url-link').length) { // 注册链接
$form.children('.url-link').before(html);
$form.children('div').last().remove();
} else {
$form.children('div').last().before(html).remove();
}
// 点击登录
this.$el.delegate('.login-third-box .third-item', 'click', function(e){
if (_.get(G, 'user.info')) { // 已登录的直接跳转至主页面
return location.href = './';
}
var type = $(e.currentTarget).attr("data-type");
self.Bind.bind(type);
});
}
});
wget 'https://sme10.lists2.roe3.org/kodbox/plugins/oauth/static/oauth/user.js'
ClassBase.define({
init: function (param) {
this.loginWith = _.split(param.load.loginWith, ',');
if (!this.loginWith) return; // 登录项为空,直接返回
this.thirdItems = param.load.thirdItems;
this.Bind = new param.Bind();
var self = this;
this.request = new kodApi.request({parent: this});
this.request.requestSend('plugin/oauth/bind', {method: 'bindInfo'}, function(result){
self.initView(result.data);
});
},
// 第三方账号操作项
initView: function(data){
var opt = '';
var self = this;
_.each(this.loginWith, function(type){
var name = self.thirdItems[type];
var content = '<a class="bind" href="javascript:void(0)">'+LNG['user.clickBind']+'</a>';
var right = '';
var isBind = _.get(data.bind, type+'Bind') || 0;
if (isBind) {
content = LNG['user.binded'];
right = '<span class="col-action"><a class="unbind" href="javascript:void(0)">'+LNG['user.unbind']+'</a></span>';
}
opt += '<div id="'+type+'" class="acc-row">\
<span class="col-title">\
<i class="font-icon ri-'+(type == 'weixin' ? 'wechat' : type)+'-fill with-color"></i>\
<span>'+name+'</span>\
</span>\
<span class="col-content">'+content+'</span>'+right+'\
</div>';
});
var html = '<div class="third-set mt-40">\
<div class="acc-title">'+LNG['user.thirdAccount']+'</div>\
<div class="acc-line"></div>\
<div>'+opt+'</div>\
</div>';
this.$('.account-page .user-set').after(html);
// 用户密码为空时,去掉原始密码项
this.emptyPwd = data.emptyPwd;
var $pwd = this.$('.account-page .user-set .form-row.item-change-password');
if (this.emptyPwd == '1') {
$pwd.find('.acc-dtl .title').remove();
var $title = $pwd.find('input[name=newpwd]').parent().prev();
$title.parent().removeClass('mt-5').addClass('title'); // 添加title样式
$title.html('<i class="font-icon ri-lock-unlock-fill size16"></i><span style="margin-left:4px;">'+LNG['common.password']+'</span>');
}
this.bindEvent();
},
// 绑定、解绑
bindEvent: function(){
var self = this;
this.$el.delegate(".third-set .bind, .third-set .unbind", 'click', function(e){
var target = $(e.currentTarget);
var type = target.parents(".acc-row").attr("id");
if (target.attr("class") == 'bind') {
return self.Bind.bind(type, 'bind', 0);
}
if(self.emptyPwd == '1') {
return Tips.tips(LNG['user.unbindWarning'],'warning',3000);
}
self.Bind.unbind(type, self);
});
}
});