mirror of http://localhost:9400/cloud/cms
parent
b83af618c5
commit
1fa04661fd
@ -0,0 +1,87 @@
|
||||
if(!qcms){
|
||||
var qcms = {}
|
||||
}
|
||||
|
||||
qcms.login = {model:null}
|
||||
qcms.login.authenticate = function (){
|
||||
var _id = qcms.login.model
|
||||
if (_id.match(/^oauth2/i)){
|
||||
;
|
||||
}else{
|
||||
var _args = qcms.login.get()
|
||||
var http = HttpClient.instance()
|
||||
http.setHeader('Content-Type','application/json')
|
||||
http.setHeader('method',_id)
|
||||
http.setData( JSON.stringify(_args))
|
||||
var _uri = ([qcms.context,'/login']).join('')
|
||||
http.post(_uri,(x)=>{
|
||||
|
||||
if(x.readyState == 4 && x.status == 200){
|
||||
|
||||
window.open(x.responseURL,'_self');
|
||||
}else{
|
||||
$('.qcms-login-error').slideDown()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
qcms.login.get = function (){
|
||||
var _args = {}
|
||||
var _nodes = $('.qcms-login-input INPUT')
|
||||
_nodes.each((_index)=>{
|
||||
var _key = $(_nodes[_index]).attr('class')
|
||||
var _value = $(_nodes[_index]).val()
|
||||
_args[_key] = _value
|
||||
})
|
||||
return _args
|
||||
}
|
||||
qcms.login.cancel = function (){
|
||||
var _nodes = $('.qcms-login-input INPUT')
|
||||
_nodes.each((_index)=>{
|
||||
$(_nodes[_index]).val('')
|
||||
})
|
||||
$('.qcms-login-error').slideUp()
|
||||
}
|
||||
/**
|
||||
* PAM authentication
|
||||
*/
|
||||
|
||||
// qcms.authenticate = {}
|
||||
// qcms.authenticate.nextcloud = function (){
|
||||
// var _uri = ([qcms.context,'/login']).join('')
|
||||
// _args = qcms.login.get()
|
||||
|
||||
// var http = HttpClient.instance()
|
||||
// http.setHeader('Content-Type','application/json')
|
||||
// // http.setHeader('method','pam')
|
||||
// http.setData( JSON.stringify(_args))
|
||||
// http.post(_uri,(x)=>{
|
||||
// if(x.readyState == 4 && x.status == 200){
|
||||
|
||||
// }
|
||||
// })
|
||||
|
||||
// }
|
||||
// qcms.authenticate.pam = function (){
|
||||
// var _uri = ([qcms.context,'/login']).join('')
|
||||
// var _args = {
|
||||
// username:$('.qcms-login-input .username').val(),
|
||||
// password:$('.qcms-login-input .password').val()
|
||||
// }
|
||||
|
||||
// var http = HttpClient.instance()
|
||||
// http.setHeader('Content-Type','application/json')
|
||||
// http.setHeader('method','pam')
|
||||
// http.setData( JSON.stringify(_args))
|
||||
// http.post(_uri,(x)=>{
|
||||
|
||||
// if(x.readyState == 4 && x.status == 200){
|
||||
|
||||
// window.open(x.responseURL,'_self')
|
||||
// ;
|
||||
// }
|
||||
// })
|
||||
// }
|
Loading…
Reference in new issue