-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2019/kw15/change password strength #551
Conversation
… settings labels, bind to user input validation function which is not working currently
…ay passwordstrength on passwordchange
… into 2019/kw15/change_password_strength
- moved passwordStrength to watch since there was a "unexpected side effect in computed property vue" in lint - found this SO post https://stackoverflow.com/questions/53757107/handling-unexpected-side-effect-in-computed-properties-vuejs
… into 2019/kw15/change_password_strength
…-Connection/Human-Connection into 2019/kw15/change_password_strength
The strange error messages occur on master aswell - therefor not the fault of this pr / styleguide-update |
const strength = !isEmpty(this.pass) ? zxcvbn(this.pass).score : null | ||
if (strength !== this.strength) { | ||
this.strength = strength | ||
this.isSecure = Boolean(strength >= 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authored by mattwr18
May 9, 2019
Outdated (history rewrite) - original diff
@@ -0,0 +1,139 @@
+<template>
+ <div class="field">
+ <div class="password-strength-meter">
+ <div
+ class="password-strength-meter-inner"
+ :class="strengthClass"
+ />
+ </div>
+ <p class="help">
+ <span
+ v-if="pass"
+ :class="{ insecure: (passwordStrength < 3) }"
+ >
+ {{ $t('settings.security.change-password.passwordSecurity') }}:
+ <strong>{{ $t(`settings.security.change-password.passwordStrength${passwordStrength}`) }}</strong>
+ </span>
+ <span v-else> </span>
+ </p>
+ </div>
+</template>
+
+<script>
+import zxcvbn from 'zxcvbn'
+import { isEmpty } from 'lodash'
+
+export default {
+ name: 'PasswordMeter',
+ props: {
+ password: {
+ type: String,
+ required: true
+ }
+ },
+ data() {
+ return {
+ lastScore: 0,
+ pass: this.password || null
+ }
+ },
+ computed: {
+ strengthClass() {
+ return `strength-${this.passwordStrength}`
+ }
+ },
+ watch: {
+ /**
+ * passwordStrength is the score calculated by zxcvbn
+ * @return {Number} Password Strength Score
+ */
+ passwordStrength() {
I moved this @ulfgebhardt because it was failing the linting
please see my commit message with a link to the SO post where I found the suggestion to move it to watch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authored by ulfgebhardt
May 9, 2019
I Agree 100% - thanks for fixing this. As you can see i am still new to vue <3
thanks @mattwr18 for doing this - much appreciated! |
@mattwr18 I removed the test case - but there is still problems with the UI. visible as console errors in the tests |
@ulfgebhardt, I have added an issue for this, as it is not part of the scope of this |
Codecov Report
@@ Coverage Diff @@
## master #551 +/- ##
=========================================
+ Coverage 17.57% 18.77% +1.2%
=========================================
Files 154 156 +2
Lines 2157 2200 +43
Branches 98 107 +9
=========================================
+ Hits 379 413 +34
- Misses 1756 1764 +8
- Partials 22 23 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job @ulfgebhardt!!
really excited about this feature!!! I love it when I see that someone has implemented a password strength feature!!
And awesome you were able to learn more about vue, I too learned having put in a commit!
Pullrequest
Issues
Todo