From 1f8c1a5cc311a315849736bf1d069f1fde7f7a2c Mon Sep 17 00:00:00 2001 From: Johannes Schill Date: Wed, 13 Dec 2017 09:09:58 +0100 Subject: [PATCH] fix: Handle state when no password is entered on registration page (#9879) --- public/app/core/components/PasswordStrength.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/app/core/components/PasswordStrength.tsx b/public/app/core/components/PasswordStrength.tsx index 1fede3e5cd5..8f92b18445c 100644 --- a/public/app/core/components/PasswordStrength.tsx +++ b/public/app/core/components/PasswordStrength.tsx @@ -11,15 +11,20 @@ export class PasswordStrength extends React.Component { } render() { + const { password } = this.props; let strengthText = "strength: strong like a bull."; let strengthClass = "password-strength-good"; - if (this.props.password.length <= 8) { + if (!password) { + return null; + } + + if (password.length <= 8) { strengthText = "strength: you can do better."; strengthClass = "password-strength-ok"; } - if (this.props.password.length < 4) { + if (password.length < 4) { strengthText = "strength: weak sauce."; strengthClass = "password-strength-bad"; }