This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Support second passphrase - Closes #21 #145
Merged
Merged
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
c9ce16b
remove dependencies as they're not used in login component anymore
reyraa 543d101
create Passphrase service only handle passphrase generation for given…
reyraa 4963639
remove mdDialog since we'll use it in a separated directive, add Pass…
reyraa 0e142e4
remove all the functions generating passphrase since Passphrase servi…
reyraa e5be5ea
import passphrase service to project
reyraa 23890ca
import directives and factories of setting primary and second passphrase
reyraa ec9603a
create a passphrase directive to use passphrase service and manage re…
reyraa d07ffea
remove styles of mdDialogs
reyraa f04eb07
replace markups concerning passphrase with equivalent directives
reyraa 4805526
create setSecondPass directive: - uses instanse of passphrase directi…
reyraa 20aab5f
addapt tests according to changes in login.js
reyraa 4eca9a8
create setSecondPass service: uses mdDialog to show/hide modals of se…
reyraa 5a64ed0
create unit tests for passphrase service
reyraa 41edf41
unit test coverage for passphrase directive used in login page
reyraa 87408d8
remove unnecessary comments
reyraa f776080
import setSecondPass service to test modules
reyraa f1fa111
fix method names
reyraa c21af08
increased test coverage in setSecondPass directive
reyraa 9d18e38
minor fixing
reyraa 0b5c832
remove unused controller, fix the name of like function
reyraa d9981cc
restructure passphrase directive unit tests
reyraa 403928b
hide second passphrase button if already set
reyraa 396cb1a
add API call to set second passphrase, handle error messages
reyraa d0c529e
adapt tests accordingly
reyraa 0b94620
minor fixins before digestion
reyraa 0ba7b65
increate test converage
reyraa 919c727
Merge branch 'development' into 21-support-second-passphrase
reyraa e602f9e
Merge branch 'development' into 21-support-second-passphrase
reyraa 913d3af
tyding up a condition block
reyraa 37d7c80
increased test coverage
reyraa c3ec49e
disable eslint for vriable usage as object parameter
reyraa d114646
fix typos
reyraa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import './passphrase.less'; | ||
|
||
app.directive('passphrase', ($rootScope, $document, Passphrase, $mdDialog, $mdMedia, $timeout) => { | ||
/* eslint no-param-reassign: ["error", { "props": false }] */ | ||
const PassphraseLink = function (scope, element, attrs) { | ||
const bindEvents = (listener) => { | ||
$document.bind('mousemove', listener); | ||
}; | ||
|
||
const unbindEvents = (listener) => { | ||
$document.unbind('mousemove', listener); | ||
}; | ||
|
||
const generateAndDoubleCheck = (seed) => { | ||
const passphrase = Passphrase.generatePassPhrase(seed); | ||
|
||
const ok = () => { | ||
// this.input_passphrase = passphrase; | ||
$timeout(() => { | ||
$rootScope.$broadcast('onAfterSignup', { | ||
passphrase, | ||
target: attrs.target, | ||
}); | ||
}, 100); | ||
}; | ||
|
||
$mdDialog.show({ | ||
controllerAs: '$ctrl', | ||
controller: /* @ngInject*/ class save { | ||
constructor($scope) { | ||
this.$mdDialog = $mdDialog; | ||
this.passphrase = passphrase; | ||
|
||
$scope.$watch('$ctrl.missing_input', () => { | ||
this.missing_ok = this.missing_input && this.missing_input === this.missing_word; | ||
}); | ||
} | ||
|
||
next() { | ||
this.enter = true; | ||
|
||
const words = this.passphrase.split(' '); | ||
const missingNumber = parseInt(Math.random() * words.length, 10); | ||
|
||
this.missing_word = words[missingNumber]; | ||
this.pre = words.slice(0, missingNumber).join(' '); | ||
this.pos = words.slice(missingNumber + 1).join(' '); | ||
} | ||
|
||
ok() { | ||
ok(); | ||
this.close(); | ||
} | ||
|
||
close() { | ||
this.$mdDialog.hide(); | ||
} | ||
}, | ||
|
||
template: require('./save.pug')(), | ||
fullscreen: ($mdMedia('sm') || $mdMedia('xs')) && this.scope.customFullscreen, | ||
}); | ||
}; | ||
|
||
const terminate = (seed) => { | ||
unbindEvents(Passphrase.listene); | ||
generateAndDoubleCheck(seed); | ||
}; | ||
|
||
scope.simulateMousemove = () => { | ||
$document.mousemove(); | ||
}; | ||
|
||
scope.mobileAndTabletcheck = (agent) => { | ||
let check = false; | ||
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(agent || navigator.userAgent || navigator.vendor || window.opera)) { | ||
check = true; | ||
} | ||
return check; | ||
}; | ||
|
||
Passphrase.init(); | ||
bindEvents(e => Passphrase.listener(e, terminate)); | ||
scope.progress = Passphrase.progress; | ||
}; | ||
|
||
return { | ||
link: PassphraseLink, | ||
restrict: 'E', | ||
scope: { | ||
onLogin: '=', | ||
}, | ||
template: require('./passphrase.pug')(), | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
md-content.bytes .byte { | ||
display: inline-block; | ||
text-align: center; | ||
font-size: 140%; | ||
margin: 5px; | ||
font-family: monospace; | ||
|
||
&.change-add, &.change-remove { | ||
transition: all .15s ease; | ||
} | ||
|
||
&.change, &.change-add-active, &.change-remove { | ||
transform: scale(1.3); | ||
} | ||
|
||
&.change-remove-active { | ||
transform: none; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please fix indent.