mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-06-12 04:35:49 +08:00
45 lines
1.5 KiB
CoffeeScript
45 lines
1.5 KiB
CoffeeScript
$ ->
|
|
$('.action-update-password').click ->
|
|
if $('.form-password :input[name=password]').val() != $('.form-password :input[name=password2]').val()
|
|
return alert 'Two password is not equal'
|
|
|
|
$.post '/account/update_password/', JSON.stringify
|
|
old_password : $('.form-password :input[name=old_password]').val()
|
|
password: $('.form-password :input[name=password]').val()
|
|
.fail (jqXHR) ->
|
|
alert jqXHR.responseJSON?.error ? jqXHR.statusText
|
|
.success ->
|
|
alert 'Success!'
|
|
|
|
$('.action-save').click ->
|
|
$.post '/account/update_setting/', JSON.stringify
|
|
name: 'qq'
|
|
value: $(':input[name=qq]').val()
|
|
.fail (jqXHR) ->
|
|
alert jqXHR.responseJSON?.error ? jqXHR.statusText
|
|
.success ->
|
|
alert 'Success!'
|
|
|
|
$('.action-update-email').click ->
|
|
$.post '/account/update_email/', JSON.stringify
|
|
password: $('.form-email :input[name=password]').val()
|
|
email: $(':input[name=email]').val()
|
|
.fail (jqXHR) ->
|
|
alert jqXHR.responseJSON?.error ? jqXHR.statusText
|
|
.success ->
|
|
alert 'Success!'
|
|
|
|
$('.action-use').click ->
|
|
$.post '/account/coupon_info/', JSON.stringify
|
|
code: $(':input[name=coupon_code]').val()
|
|
.fail (jqXHR) ->
|
|
alert jqXHR.responseJSON?.error ? jqXHR.statusText
|
|
.success (data) ->
|
|
if window.confirm data.message
|
|
$.post '/account/use_coupon/', JSON.stringify
|
|
code: $(':input[name=coupon_code]').val()
|
|
.fail (jqXHR) ->
|
|
alert jqXHR.responseJSON?.error ? jqXHR.statusText
|
|
.success ->
|
|
alert 'Success!'
|