uname, password -> login, password (breaks socket)
This commit is contained in:
parent
d0f7de6208
commit
19a1f628ca
2 changed files with 26 additions and 21 deletions
|
@ -9,13 +9,25 @@ $ ->
|
||||||
# style sheet
|
# style sheet
|
||||||
require './style/custom.scss'
|
require './style/custom.scss'
|
||||||
|
|
||||||
# init Socket.IO
|
# # init Socket.IO
|
||||||
socket = io()
|
# socket = io()
|
||||||
|
|
||||||
|
# reset forms
|
||||||
|
$('form').each ->
|
||||||
|
that = @
|
||||||
|
@fullReset = ->
|
||||||
|
$('input', that).each ->
|
||||||
|
$(that).removeClass 'is-invalid'
|
||||||
|
$(that).removeClass 'is-valid'
|
||||||
|
that.reset()
|
||||||
|
|
||||||
# login form
|
# login form
|
||||||
$('form[name="login"]').submit ->
|
$('form[name="login"]').submit ->
|
||||||
|
# inhibit normal form submission
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
# gather form data
|
# gather form data
|
||||||
uname = $('input[name="uname"]', @)
|
login = $('input[name="login"]', @)
|
||||||
password = $('input[name="password"]', @)
|
password = $('input[name="password"]', @)
|
||||||
|
|
||||||
# transmit form data
|
# transmit form data
|
||||||
|
@ -23,14 +35,15 @@ $ ->
|
||||||
console.log 'emitted "login", "%s", "%s"', uname.val(), password.val()
|
console.log 'emitted "login", "%s", "%s"', uname.val(), password.val()
|
||||||
|
|
||||||
# reset form
|
# reset form
|
||||||
@reset()
|
@fullReset()
|
||||||
# inhibit actual submission
|
|
||||||
false
|
|
||||||
|
|
||||||
# register form
|
# register form
|
||||||
$('form[name="register"]').submit ->
|
$('form[name="register"]').submit (event) ->
|
||||||
|
# inhibit normal form submission
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
# gather form data
|
# gather form data
|
||||||
uname = $('input[name="uname"]', @)
|
login = $('input[name="login"]', @)
|
||||||
password = $('input[name="password"]', @)
|
password = $('input[name="password"]', @)
|
||||||
confirm = $('input[name="confirm"]', @)
|
confirm = $('input[name="confirm"]', @)
|
||||||
|
|
||||||
|
@ -42,17 +55,9 @@ $ ->
|
||||||
console.log 'emitted "register", "%s", "%s"', uname.val(), password.val()
|
console.log 'emitted "register", "%s", "%s"', uname.val(), password.val()
|
||||||
|
|
||||||
# reset form
|
# reset form
|
||||||
$('input', @).each ->
|
@fullReset()
|
||||||
$(@).removeClass 'is-invalid'
|
|
||||||
$(@).removeClass 'is-valid'
|
|
||||||
return
|
|
||||||
|
|
||||||
@reset()
|
|
||||||
|
|
||||||
else
|
else
|
||||||
confirm.val ''
|
confirm.val ''
|
||||||
confirm.addClass 'is-invalid'
|
confirm.addClass 'is-invalid'
|
||||||
confirm.focus()
|
confirm.focus()
|
||||||
|
|
||||||
# inhibit actual submission
|
|
||||||
false
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ html
|
||||||
h3 Login
|
h3 Login
|
||||||
form(name="login")
|
form(name="login")
|
||||||
div.form-group
|
div.form-group
|
||||||
label(for="uname") User name:
|
label(for="login") User name:
|
||||||
input.form-control(name="uname" required)
|
input.form-control(name="login" required)
|
||||||
|
|
||||||
div.form-group
|
div.form-group
|
||||||
label(for="password") Password:
|
label(for="password") Password:
|
||||||
|
@ -37,8 +37,8 @@ html
|
||||||
h3 Register
|
h3 Register
|
||||||
form(name="register")
|
form(name="register")
|
||||||
div.form-group
|
div.form-group
|
||||||
label(for="uname") User name:
|
label(for="login") User name:
|
||||||
input.form-control(name="uname" required)
|
input.form-control(name="login" required)
|
||||||
div.invalid-feedback User name not available.
|
div.invalid-feedback User name not available.
|
||||||
|
|
||||||
div.form-group
|
div.form-group
|
||||||
|
|
Reference in a new issue