mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
opti: delete plugins path
This commit is contained in:
parent
ed89b07912
commit
fd8058522d
@ -1 +0,0 @@
|
||||
# yapi-plugin-qsso
|
@ -1,16 +0,0 @@
|
||||
import React from 'react';
|
||||
const Qsso = require('./qsso-lib');
|
||||
|
||||
class QssoComponent extends React.Component{
|
||||
componentDidMount(){
|
||||
Qsso.attach('qsso-login', '/api/user/login_by_token');
|
||||
}
|
||||
render(){
|
||||
return <button id="qsso-login" className="btn-home btn-home-normal" >QSSO 登录</button>;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function(){
|
||||
this.bindHook('third_login', QssoComponent);
|
||||
};
|
||||
|
@ -1,46 +0,0 @@
|
||||
{
|
||||
"_from": "yapi-plugin-qsso@^1.0.2",
|
||||
"_id": "yapi-plugin-qsso@1.0.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-1Sy2zY4FUeMr4BoGAVLyaQeNizTiOl5enPOeJUlHPDTqawP9loBBdfUdHg89OLPJai/g0OD3kncTH2+sNPu5/g==",
|
||||
"_location": "/yapi-plugin-qsso",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "yapi-plugin-qsso@^1.0.2",
|
||||
"name": "yapi-plugin-qsso",
|
||||
"escapedName": "yapi-plugin-qsso",
|
||||
"rawSpec": "^1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/yapi-plugin-qsso/-/yapi-plugin-qsso-1.0.5.tgz",
|
||||
"_shasum": "c9da87bdd7a378e601d38fc8fcce965f4337d27e",
|
||||
"_spec": "yapi-plugin-qsso@^1.0.2",
|
||||
"_where": "/Users/qitmac000249/Downloads/yapi_project",
|
||||
"author": "",
|
||||
"bugs": {
|
||||
"url": "https://github.com/YMFE/yapi-plugin-qsso/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "",
|
||||
"homepage": "https://github.com/YMFE/yapi-plugin-qsso#readme",
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "yapi-plugin-qsso",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/YMFE/yapi-plugin-qsso.git"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node server.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "1.0.5"
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
// file_id:2D7ABF69-3BC0-4175-98C9-5C3D5CB00158 -- nerver change this !!
|
||||
|
||||
/*
|
||||
* file: qsso-auth.js
|
||||
* URL: https://qsso.corp.qunar.com/lib/qsso-auth.js
|
||||
* written by zhibin.ning
|
||||
* version: 0.1
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
var AUTH_SERVER = 'https://qsso.corp.qunar.com',
|
||||
LOGIN_PAGE = '/login.php',
|
||||
SORRY_PAGE = '/sorry.html';
|
||||
|
||||
if (location.hostname.match(/qunar\.ctripgroup\.com$/i)) {
|
||||
AUTH_SERVER = 'https://qunar.ctripgroup.com/sec/qsso/api';
|
||||
}
|
||||
|
||||
var qualifyURL = function (url, encode) {
|
||||
url = url || '';
|
||||
var ret = location.protocol + '//' + location.host + (url.substr(0, 1) === '/' ? '' : location.pathname.match(/.*\//)) + url;
|
||||
if (encode) {
|
||||
ret = encodeURIComponent(ret);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var URLStringify = function (o) {
|
||||
var ret = [];
|
||||
for (var i in o) {
|
||||
// ret.push( encodeURIComponent(i) + '=' + encodeURIComponent(o[i]) );
|
||||
ret.push(i + '=' + o[i]);
|
||||
}
|
||||
return ret.join('&');
|
||||
};
|
||||
var qsso;
|
||||
module.exports = qsso = {
|
||||
'auth': function (loginURI, opt_ext) {
|
||||
if (!location.hostname.match(/\.qunar(man|ops)?\.com$|\.qunarman\.com$|qunar\.it$|\.928383\.com$|^928383\.com$|qunar\.ctripgroup\.c(om|n)$|\.ctrip(corp)?\.com$|^opsdata\.me$|\.mofun\.com$/i)) {
|
||||
location.href = AUTH_SERVER + SORRY_PAGE + '?host=' + qualifyURL('', true);
|
||||
return;
|
||||
}
|
||||
var ret = qualifyURL(loginURI, true);
|
||||
|
||||
var redirectURL = AUTH_SERVER + LOGIN_PAGE + '?ret=' + ret + (opt_ext ? '&ext=' + encodeURIComponent(URLStringify(opt_ext)) : '');
|
||||
// console.log(redirectURL);
|
||||
location.href = redirectURL;
|
||||
},
|
||||
|
||||
'attach': function (eid, loginURI, opt_ext) {
|
||||
var login = function () {
|
||||
qsso.auth(loginURI, opt_ext);
|
||||
|
||||
};
|
||||
document.getElementById(eid).onclick = login;
|
||||
if (location.hash.match('qsso-auto-login')) {
|
||||
login();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,27 +0,0 @@
|
||||
const request = require('request');
|
||||
|
||||
module.exports = function () {
|
||||
this.bindHook('third_login', (ctx) => {
|
||||
let token = ctx.request.body.token || ctx.request.query.token;
|
||||
console.log(token)
|
||||
return new Promise((resolve, reject) => {
|
||||
request('http://qsso.corp.qunar.com/api/verifytoken.php?token=' + token, function (error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
let result = JSON.parse(body);
|
||||
if (result && result.ret === true) {
|
||||
let ret = {
|
||||
email: result.userId + '@qunar.com',
|
||||
username: result.data.userInfo.name
|
||||
};
|
||||
resolve(ret);
|
||||
} else {
|
||||
reject(result);
|
||||
}
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user