clientside-view-modal-login_signup
v1.0.9
Published
a clientside view module which generates a login/signup modal with input extraction and clean toggle. utilizes clientside-view-loader modules.
Downloads
1
Maintainers
Readme
clientside-view-modal-login_signup
load("clientside-view-loader")
.then(view=>view.load("clientside-view-modal-login_signup").build());
.then((modal)=>{
document.body.appendChild(modal);
modal.show("login");
})
generates a fully functional one of these:
with which you can do things like this:
.then((modal)=>{
document.querySelector("#signup_button").onclick = ()=>{modal.handler.show("signup")}
document.querySelector("#loginup_button").onclick = ()=>{modal.handler.show("login")}
modal.submission_button.signup.onclick = function(){
require("clientside-controller-user_sessions")
.then((controller)=>{
return controller.signin("signup", {
email : modal.extract.email(),
password : modal.extract.password(),
})
})
.then((response)=>{
alert("Success!");
modal.submission_button.login.onclick(); // after signup automatically sign user in
})
}
modal.submission_button.login.onclick = function(){
require("clientside-controller-user_sessions")
.then((controller)=>{
return controller.signin("login", {
email : modal.extract.email(),
password : modal.extract.password(),
})
})
.then((response)=>{
if(response == "SCS"){
window.location.href = "/my/dashboard";
} else {
console.error("Response for login was not expected: " + response)
alert("An unknown error has occured.");
}
})
}
})