From 9d73e7eb1e0dae044ef386211b214e01624a3364 Mon Sep 17 00:00:00 2001 From: Björn Schießle Date: Wed, 6 Feb 2013 11:38:03 +0100 Subject: let the user change his display name, if supported by the back-end --- settings/js/personal.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'settings/js/personal.js') diff --git a/settings/js/personal.js b/settings/js/personal.js index a866e321ad6..d9455b3786b 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -31,6 +31,33 @@ $(document).ready(function(){ } }); + + $("#displaynamebutton").click( function(){ + if ($('#displayName').val() != '' ) { + // Serialize the data + var post = $( "#displaynameform" ).serialize(); + $('#displaynamechanged').hide(); + $('#displaynemerror').hide(); + // Ajax foo + $.post( 'ajax/changedisplayname.php', post, function(data){ + if( data.status == "success" ){ + $('#displaynamechanged').show(); + } + else{ + $('#newdisplayname').val(data.data.displayName) + $('#displaynameerror').html( data.data.message ); + $('#displaynameerror').show(); + } + }); + return false; + } else { + $('#displayName').val($('#oldDisplayName').val()); + $('#displaynamechanged').hide(); + $('#displaynameerror').show(); + return false; + } + + }); $('#lostpassword #email').blur(function(event){ if ($(this).val() == this.defaultValue){ -- cgit v1.2.3