[Pkg-owncloud-commits] [owncloud] 69/122: Allow user to set an empty email address

David Prévot taffit at moszumanska.debian.org
Sat May 9 00:00:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 5fd849f5457cd7f9d47c6fa5019ff0f79fcbc6af
Author: Morris Jobke <hey at morrisjobke.de>
Date:   Tue May 5 11:58:19 2015 +0200

    Allow user to set an empty email address
    
    * fixes #16057
---
 settings/controller/userscontroller.php | 7 ++++++-
 settings/js/personal.js                 | 9 +++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/settings/controller/userscontroller.php b/settings/controller/userscontroller.php
index 46782a0..e9ffc36 100644
--- a/settings/controller/userscontroller.php
+++ b/settings/controller/userscontroller.php
@@ -504,7 +504,12 @@ class UsersController extends Controller {
 			);
 		}
 
-		$this->config->setUserValue($id, 'settings', 'email', $mailAddress);
+		// delete user value if email address is empty
+		if($mailAddress === '') {
+			$this->config->deleteUserValue($id, 'settings', 'email');
+		} else {
+			$this->config->setUserValue($id, 'settings', 'email', $mailAddress);
+		}
 
 		return new DataResponse(
 			array(
diff --git a/settings/js/personal.js b/settings/js/personal.js
index c9ecfdb..3745b13 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -12,8 +12,9 @@
  * user or 1 second after the last data entry
  *
  * @param callback
+ * @param allowEmptyValue if this is set to true the callback is also called when the value is empty
  */
-jQuery.fn.keyUpDelayedOrEnter = function (callback) {
+jQuery.fn.keyUpDelayedOrEnter = function (callback, allowEmptyValue) {
 	var cb = callback;
 	var that = this;
 	this.keyup(_.debounce(function (event) {
@@ -21,13 +22,13 @@ jQuery.fn.keyUpDelayedOrEnter = function (callback) {
 		if (event.keyCode === 13) {
 			return;
 		}
-		if (that.val() !== '') {
+		if (allowEmptyValue || that.val() !== '') {
 			cb();
 		}
 	}, 1000));
 
 	this.keypress(function (event) {
-		if (event.keyCode === 13 && that.val() !== '') {
+		if (event.keyCode === 13 && (allowEmptyValue || that.val() !== '')) {
 			event.preventDefault();
 			cb();
 		}
@@ -213,7 +214,7 @@ $(document).ready(function () {
 	});
 
 	$('#displayName').keyUpDelayedOrEnter(changeDisplayName);
-	$('#email').keyUpDelayedOrEnter(changeEmailAddress);
+	$('#email').keyUpDelayedOrEnter(changeEmailAddress, true);
 
 	$("#languageinput").change(function () {
 		// Serialize the data

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list