Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Move custom_button.js script into static root #261

Merged
merged 11 commits into from
Jun 13, 2023
File renamed without changes.
30 changes: 30 additions & 0 deletions src/static/custom_button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
window.addEventListener("load", function () {

var base_url = window.location.origin

var login_button = document.createElement('button')
login_button.innerHTML = 'Log in'
login_button.classList.add('btn', 'authorize')
login_button.onclick = function () {
window.location.href = base_url + '/logto/sign-in'
}

var user_button = document.createElement('button')
user_button.innerHTML = 'User info'
user_button.classList.add('btn', 'authorize')
user_button.onclick = function () {
window.location.href = base_url + '/user'
}

var logout_button = document.createElement('button')
logout_button.innerHTML = 'Log out'
logout_button.classList.add('btn', 'authorize')
logout_button.onclick = function () {
window.location.href = base_url + '/logto/sign-out'
}

var auth_pan = document.getElementsByClassName('auth-wrapper')[0]
auth_pan.appendChild(login_button)
auth_pan.appendChild(user_button)
auth_pan.appendChild(logout_button)
})