From: Chip Black Date: Thu, 19 Jan 2012 08:02:16 +0000 (-0600) Subject: Add front-end password changing bits X-Git-Tag: v1.6.3~2 X-Git-Url: http://git.bytex64.net/?a=commitdiff_plain;h=25d05f5f2c444ca67199b7108fe74fb728cf8554;p=blerg.git Add front-end password changing bits --- diff --git a/www/index.html b/www/index.html index 42a1c01..d99212b 100644 --- a/www/index.html +++ b/www/index.html @@ -31,10 +31,10 @@ username: password: -

I want to blërg!

+

I want to blërg!

diff --git a/www/js/blerg.js b/www/js/blerg.js index 83483fa..2ef48d9 100644 --- a/www/js/blerg.js +++ b/www/js/blerg.js @@ -647,6 +647,36 @@ function signup_cancel() { urlSwitch(); } +function passwd() { + var old_password = $('passwd.old_password').value; + var new_password = $('passwd.new_password').value; + + new Ajax.Request(baseURL + '/passwd', { + parameters: { + username: loginStatus.username, + password: old_password, + new_password: new_password + }, + onSuccess: function(r) { + if (r.responseJSON.status == 'success') { + alert('Password changed'); + passwd_cancel(); + } else { + alert('Password change failed. Your password has NOT been changed.'); + } + }, + onFailure: function(r) { + alert('Password change error'); + } + }); +} + +function passwd_cancel() { + $('passwd').hide(); + $('navigation').show(); + urlSwitch(); +} + function subscribe() { new Ajax.Request(baseURL + '/subscribe/' + currentPager.username, { method: 'post', @@ -814,6 +844,10 @@ Welcome.prototype.hide = function() { $('welcome').hide(); } +Welcome.prototype.updateState = function() { + this.show(); +} + function ExternalURLPost(m) { this.title = decodeURIComponent(m[1]).replace(']','').replace('[',''); this.url = decodeURIComponent(m[2]);