From 93243f432ff5b049284873fde6144b3187cc0e6d Mon Sep 17 00:00:00 2001 From: opi Date: Fri, 6 May 2016 17:17:09 +0200 Subject: [PATCH] [enh][ux] Prefill email field value with username if empty. --- src/js/yunohost/controllers/users.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/js/yunohost/controllers/users.js b/src/js/yunohost/controllers/users.js index cbc4999d..8b029eba 100644 --- a/src/js/yunohost/controllers/users.js +++ b/src/js/yunohost/controllers/users.js @@ -23,8 +23,15 @@ // Password min length data.password_min_length = PASSWORD_MIN_LENGTH; - - c.view('user/user_create', data); + c.view('user/user_create', data, function(){ + var usernameField = $('#username'); + usernameField.on('blur', function(){ + var emailField = $('#email'); + if (emailField.val() == '') { + emailField.val(usernameField.val()); + } + }); + }); }); });