From 82953db026a381d7b1231427587d92dfc938b3a5 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Mon, 11 Jun 2018 18:13:38 -0300 Subject: [PATCH] Make password input show the generated random text --- .../client/tabs/userEdit.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/rocketchat-ui-flextab/client/tabs/userEdit.js b/packages/rocketchat-ui-flextab/client/tabs/userEdit.js index 59f63b25d2dd1..8f6019f1d6e4d 100644 --- a/packages/rocketchat-ui-flextab/client/tabs/userEdit.js +++ b/packages/rocketchat-ui-flextab/client/tabs/userEdit.js @@ -52,7 +52,20 @@ Template.userEdit.events({ 'click #randomPassword'(e) { e.stopPropagation(); e.preventDefault(); - $('#password').val(Random.id()); + e.target.classList.add('loading'); + $('#password').val(''); + setTimeout(() => { + $('#password').val(Random.id()); + e.target.classList.remove('loading'); + }, 1000); + }, + + 'mouseover #password'(e) { + e.target.type = 'text'; + }, + + 'mouseout #password'(e) { + e.target.type = 'password'; }, 'click #addRole'(e, instance) { @@ -74,7 +87,6 @@ Template.userEdit.events({ } }); - Template.userEdit.onCreated(function() { this.user = this.data != null ? this.data.user : undefined; this.roles = this.user ? new ReactiveVar(this.user.roles) : new ReactiveVar([]);