1$(function() { 2 3 //ç¹å»éªè¯ç æ´æ¢ 4 $('#captchaImg').click(function() { 5 $(this).attr('src', '/ucs/api/v1/captchas' + '?' + Math.random()); 6 }); 7 8 //æ¾åå¯ç¢¼ 9 $("#findPassWordBtn").click(function() { 10 window.location.href = "/ucs/login/retrievePassword" 11 }); 12 13 14 //ç¹å»ç»å½æé® 15 $("#loginBtn").click(function() { 16 var username = $("#login-username").val(); 17 var password = $("#login-password").val(); 18 var captcha = $("#login-validate").val(); 19 20 if (username == "" || password == "" || captcha == "" || username == null || password == null || captcha == null) { 21 $("#alert_fail").text(msg['jsLang.notBlank']); 22 $("#alert_fail").fadeIn(1500); 23 $("#alert_fail").fadeOut(1500); 24 $('#captchaImg').attr('src', '/ucs/api/v1/captchas' + '?' + Math.random()); 25 } else { 26 $.ajax({ 27 url: '/ucs/api/v1/oauth/token', 28 data: { 29 'username': username, 30 'password': password, 31 'captcha': captcha 32 }, 33 dataType: "json", //æ°æ®ç±»å 34 type: "POST", //ç±»å 35 timeout: 2000, //è¶ æ¶ 36 //è¯·æ±æå 37 success: function(result, status) { 38 console.log("1=="+result.message) 39 if (result.code == 0) { 40 var token = result.data.access_token; 41 //è·åæçä¿¡æ¯è®¤è¯ Authorization 42 var Authorization = 'Bearer' + token; 43 $.cookie('access_token', token, { path: '/', domain: domain }); 44 $.ajax({
45 type: 'get', 46 url: '/ucs/api/v1/private/profile', 47 headers: { 48 Authorization: Authorization, 49 Accept: 'application/json; charset=utf-8', 50 }, 51 contentType: 'application/x-www-form-urlencoded', 52 dataType: "JSON", 53 success: function(result, status) { 54 var username = result.data.username; 55 var userId = result.data.uuid; 56 var deleted = result.data.deleted; 57 if(deleted=="1"){ 58 $("#alert_fail").text(msg['jsLang.passwordFail']); 59 $("#alert_fail").fadeIn(1500); 60 $("#alert_fail").fadeOut(1500); 61 $('#captchaImg').attr('src', '/ucs/api/v1/captchas' + '?' + Math.random()); 62 }else{ 63 //console.log("ç»å½ç¨æ· = "+username); 64 $.cookie('uuid', userId, { path: '/', domain: domain }); 65 $.cookie('username', username, { path: '/', domain: domain }); 66 /* ç»å½é¡µé¢ 跳转 */ 67 var url = $("#referer").val(); 68 //console.log("url = " +url) 69 window.location.href = url; 70 } 71 }, 72 }); 73 } else { 74 $("#alert_fail").text(result.message || msg['jsLang.passwordFail']); 75 $("#alert_fail").fadeIn(1500); 76 $("#alert_fail").fadeOut(1500); 77 $('#captchaImg').attr('src', '/ucs/api/v1/captchas' + '?' + Math.random()); 78 } 79 }, 80 error: function(result) { 81 $("#alert_fail").text(result.message) 82 $("#alert_fail").fadeIn(1500); 83 $("#alert_fail").fadeOut(1500); 84 $('#captchaImg').attr('src', '/ucs/api/v1/captchas' + '?' + Math.random()); 85 } 86 }) 87 } 88 89 }) 90 91}); 92 93function onGoogleSignIn(googleUser) { 94 // Useful data for your client-side scripts: 95 var profile = googleUser.getBasicProfile(); 96 console.log("ID: " + profile.getId()); 97 console.log('Full Name: ' + profile.getName()); 98 console.log('Given Name: ' + profile.getGivenName()); 99 console.log('Family Name: ' + profile.getFamilyName()); 100 console.log("Image URL: " + profile.getImageUrl()); 101 console.log("Email: " + profile.getEmail()); 102 103 // The ID token you need to pass to your backend: 104 var id_token = googleUser.getAuthResponse().id_token; 105 console.log("ID Token: " + id_token); 106}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.