diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php
index 98c2a8b37a135a30655b92cb244b4b94ca7c52d2..e7e67115ddadd8ac0cb0f050431d45d105202b5f 100644
--- a/settings/ajax/changepassword.php
+++ b/settings/ajax/changepassword.php
@@ -12,7 +12,7 @@ if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' ))
 	exit();
 }
 
-$username = $_POST["username"];
+$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
 $password = $_POST["password"];
 
 // Return Success story
diff --git a/settings/js/personal.js b/settings/js/personal.js
index e38eef62a8bdda535e81de800152ca105918fefc..aad57224388a6f5f15e1f6a4f800975d25b46e12 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -6,23 +6,29 @@
 
 $(document).ready(function(){
 	$("#passwordbutton").click( function(){
-		// Serialize the data
-		var post = $( "#passwordform" ).serialize();
-		$('#passwordchanged').hide();
-		$('#passworderror').hide();
-		// Ajax foo
-		$.post( 'ajax/changepassword.php', post, function(data){
-			if( data.status == "success" ){
-				$('#pass1').val('');
-				$('#pass2').val('');
-				$('#passwordchanged').show();
-			}
-			else{
-				$('#passworderror').html( data.data.message );
-				$('#passworderror').show();
-			}
-		});
-		return false;
+		if ($('#pass1').val() != '' && $('#pass2').val() != '') {
+			// Serialize the data
+			var post = $( "#passwordform" ).serialize();
+			$('#passwordchanged').hide();
+			$('#passworderror').hide();
+			// Ajax foo
+			$.post( 'ajax/changepassword.php', post, function(data){
+				if( data.status == "success" ){
+					$('#pass1').val('');
+					$('#pass2').val('');
+					$('#passwordchanged').show();
+				}
+				else{
+					$('#passworderror').html( data.data.message );
+					$('#passworderror').show();
+				}
+			});
+			return false;
+		} else {
+			$('passworderror').show();
+			return false;
+		}
+
 	});
 	
 	$("#languageinput").change( function(){