-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from laopisai/packed-format
Packed format
- Loading branch information
Showing
6 changed files
with
139 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,65 @@ | ||
'use strict'; | ||
/* Handle for register form submission */ | ||
$('#register').submit(function(event) { | ||
event.preventDefault(); | ||
// /* Handle for register form submission */ | ||
// $('#register').submit(function(event) { | ||
// event.preventDefault(); | ||
|
||
let username = this.username.value; | ||
let password = this.password.value; | ||
let name = this.name.value; | ||
// let username = this.username.value; | ||
// let password = this.password.value; | ||
// let name = this.name.value; | ||
|
||
if(!username || !password || !name) { | ||
alert('Name, username or password is missing!') | ||
return | ||
} | ||
// if(!username || !password || !name) { | ||
// alert('Name, username or password is missing!') | ||
// return | ||
// } | ||
|
||
let formBody = {username, password, name}; | ||
// let formBody = {username, password, name}; | ||
|
||
fetch('/password/register', { | ||
method: 'POST', | ||
credentials: 'include', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(formBody) | ||
}) | ||
.then((response) => response.json()) | ||
.then((response) => { | ||
if(response.status === 'ok') { | ||
loadMainContainer() | ||
} else { | ||
alert(`Server responed with error. The message is: ${response.message}`); | ||
} | ||
}) | ||
}) | ||
// fetch('/password/register', { | ||
// method: 'POST', | ||
// credentials: 'include', | ||
// headers: { | ||
// 'Content-Type': 'application/json' | ||
// }, | ||
// body: JSON.stringify(formBody) | ||
// }) | ||
// .then((response) => response.json()) | ||
// .then((response) => { | ||
// if(response.status === 'ok') { | ||
// loadMainContainer() | ||
// } else { | ||
// alert(`Server responed with error. The message is: ${response.message}`); | ||
// } | ||
// }) | ||
// }) | ||
|
||
/* Handle for login form submission */ | ||
$('#login').submit(function(event) { | ||
event.preventDefault(); | ||
// /* Handle for login form submission */ | ||
// $('#login').submit(function(event) { | ||
// event.preventDefault(); | ||
|
||
let username = this.username.value; | ||
let password = this.password.value; | ||
// let username = this.username.value; | ||
// let password = this.password.value; | ||
|
||
if(!username || !password) { | ||
alert('Username or password is missing!') | ||
return | ||
} | ||
// if(!username || !password) { | ||
// alert('Username or password is missing!') | ||
// return | ||
// } | ||
|
||
let formBody = {username, password}; | ||
fetch('/password/login', { | ||
method: 'POST', | ||
credentials: 'include', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(formBody) | ||
}) | ||
.then((response) => response.json()) | ||
.then((response) => { | ||
if(response.status === 'ok') { | ||
loadMainContainer() | ||
} else { | ||
alert(`Server responed with error. The message is: ${response.message}`); | ||
} | ||
}) | ||
}) | ||
// let formBody = {username, password}; | ||
// fetch('/password/login', { | ||
// method: 'POST', | ||
// credentials: 'include', | ||
// headers: { | ||
// 'Content-Type': 'application/json' | ||
// }, | ||
// body: JSON.stringify(formBody) | ||
// }) | ||
// .then((response) => response.json()) | ||
// .then((response) => { | ||
// if(response.status === 'ok') { | ||
// loadMainContainer() | ||
// } else { | ||
// alert(`Server responed with error. The message is: ${response.message}`); | ||
// } | ||
// }) | ||
// }) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters