register button transfers infor from login section

This commit is contained in:
SpikeHD 2022-04-26 21:21:27 -07:00
parent 104b54d820
commit 3c493b0524
2 changed files with 11 additions and 2 deletions

View File

@ -59,7 +59,7 @@
</div>
<div id="loginPopupContentBodyBtns">
<button class="playBtn" id="loginPopupContentBodyBtnLogin" onclick="login()">Login</button>
<button class="altBtn" id="loginPopupContentBodyBtnRegister" onclick="register()">Register</button>
<button class="altBtn" id="loginPopupContentBodyBtnRegister" onclick="setRegisterSection(true)">Register</button>
</div>
<div>
<button class="altBtn" id="noLoginBtn" onclick="(() => { launchPrivate(); closeLogin()})()">

View File

@ -17,7 +17,7 @@ async function setLoginSection() {
/**
* Toggle the register section
*/
async function setRegisterSection() {
async function setRegisterSection(fromLogin = false) {
const title = document.getElementById('registerSectionTitle');
const altTitle = document.getElementById('loginSectionTitle');
const loginSection = document.getElementById('loginPopupContentBody');
@ -28,6 +28,15 @@ async function setRegisterSection() {
loginSection.style.display = 'none';
registerSection.style.removeProperty('display');
if (fromLogin) {
// Take the values from the login section and put them in the register section
const loginUsername = document.getElementById('loginUsername').value;
const loginPassword = document.getElementById('loginPassword').value;
document.getElementById('registerUsername').value = loginUsername;
document.getElementById('registerPassword').value = loginPassword;
}
}
/**