Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
libai
/
footseen-large-website
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3d774a40
authored
2 years ago
by
libai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试
parent
b9218d04
master
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
14 deletions
yazhaiTest/lib/login.js
yazhaiTest/lib/login.js
View file @
3d774a40
...
...
@@ -5,7 +5,7 @@ function loginGo(){
html
+=
' <div style="display: none;" class="login-box1">'
;
html
+=
' <div class="login-title">登入</div>'
;
html
+=
' <div class="phone-login-btn"></div>'
;
html
+=
' <div class="google-login-btn"
data-type="icon" id="buttonDiv"
></div>'
;
html
+=
' <div class="google-login-btn"
id="g_id_onload"data-client_id="534183685500-ag0vai0jh6todldi4rg6lvp0gcsojk0n.apps.googleusercontent.com" data-callback="handleCredentialResponse">
></div>'
;
html
+=
' <div class="more-login"><img src="https://www.footseen.xyz/yazhaiTest/images/more-login.png" alt=""></div>'
;
html
+=
' <div class="more-login-box">'
;
html
+=
' <div class="more-login-icon"><img src="https://www.footseen.xyz/yazhaiTest/images/login-icon2.png" alt=""></div>'
;
...
...
@@ -126,19 +126,31 @@ function loginGo(){
html
+=
'</div>'
;
$
(
".login-content"
).
html
(
html
);
function
handleCredentialResponse
(
response
)
{
console
.
log
(
"Encoded JWT ID token: "
+
response
.
credential
);
}
window
.
onload
=
function
()
{
google
.
accounts
.
id
.
initialize
({
client_id
:
"534183685500-ag0vai0jh6todldi4rg6lvp0gcsojk0n.apps.googleusercontent.com"
,
callback
:
handleCredentialResponse
});
google
.
accounts
.
id
.
renderButton
(
document
.
getElementById
(
"buttonDiv"
),
{
theme
:
"outline"
,
size
:
"390px"
,
}
// customization attributes
);
google
.
accounts
.
id
.
prompt
();
// also display the One Tap dialog
}
// decodeJwtResponse() is a custom function defined by you
// to decode the credential response.
const
responsePayload
=
decodeJwtResponse
(
response
.
credential
);
console
.
log
(
"ID: "
+
responsePayload
.
sub
);
console
.
log
(
'Full Name: '
+
responsePayload
.
name
);
console
.
log
(
'Given Name: '
+
responsePayload
.
given_name
);
console
.
log
(
'Family Name: '
+
responsePayload
.
family_name
);
console
.
log
(
"Image URL: "
+
responsePayload
.
picture
);
console
.
log
(
"Email: "
+
responsePayload
.
email
);
}
// function handleCredentialResponse(response) {
// console.log("Encoded JWT ID token: " + response.credential);
// }
// window.onload = function () {
// google.accounts.id.initialize({
// client_id: "534183685500-ag0vai0jh6todldi4rg6lvp0gcsojk0n.apps.googleusercontent.com",
// callback: handleCredentialResponse
// });
// google.accounts.id.renderButton(
// document.getElementById("buttonDiv"),
// { theme: "outline", size: "390px", } // customization attributes
// );
// google.accounts.id.prompt(); // also display the One Tap dialog
// }
var
html
=
[];
html
+=
'<div style="display: none;" class=nav-login-btn>登入/註冊</div>'
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment