-
Notifications
You must be signed in to change notification settings - Fork 60
Support second passphrase - Closes #21 #145
Conversation
reyraa
commented
Apr 25, 2017
- Breaks login component into a service, a directive and a component under the same name.
- Reuses the created service to generate the second passphrase
- Creates the relevant method on $peers service to register second passphrase
- The styling of the button on main component is temporarily and will be merged into a dropdown menu after merging with other branches.
… x,y coordination object
…quired modal views
…ve, - sets generated passphrase as second passphrase
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.
Nice work @alihaghighatkhah. I've tested it and it works very well. I have only requested some changes to error messages and test descriptions.
if (err.message === 'Missing sender second signature') { | ||
error.dialog({ text: 'You already have a second passphrase.' }); | ||
} else if (/^(Account does not have enough LSK)/.test(err.message)) { | ||
error.dialog({ text: 'You don\'t have enought credit to register second passphrase.' }); |
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.
You have insufficient funds to register a second passphrase.
} else if (/^(Account does not have enough LSK)/.test(err.message)) { | ||
error.dialog({ text: 'You don\'t have enought credit to register second passphrase.' }); | ||
} else { | ||
error.dialog({ text: 'An error happended registering your second passphrase. Please try 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.
An error occurred while registering your second passphrase. Please try again later.
scope.passConfirmSubmit = (secondsecret) => { | ||
$peers.active.setSignature(secondsecret, attrs.publicKey, attrs.passphrase) | ||
.then(() => { | ||
success.dialog('Your second passphrase is successfully registered.'); |
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.
Your second passphrase was successfully registered.
}); | ||
|
||
describe('SetSecondPassLink', () => { | ||
it('Listens for broadcasting onAfterSignup', () => { |
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.
listens for an onAfterSignup event
@@ -0,0 +1,6 @@ | |||
md-dialog.dialog-second(aria-label='Generate a second passphrase of your account') |
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.
Generate a second passphrase for your account
} else if (/^(Account does not have enough LSK)/.test(err.message)) { | ||
text = 'You don\'t have enought credit to register second passphrase.'; | ||
} else { | ||
text = 'An error happended registering your second passphrase. Please try 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.
An error occurred while registering your second passphrase. Please try again.
const unbindSpy = sinon.spy(controller.$document, 'unbind'); | ||
controller.stopNewPassphraseGeneration(); | ||
expect(unbindSpy).to.have.been.calledWith('mousemove', controller.listener); | ||
it('Listens for broadcasting onAfterSignup', () => { |
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.
listens for an onAfterSignup event
|
||
mock.expects('get').returns(undefined); | ||
describe('devTestAccount()', () => { | ||
it('calls passConfirmSubmit with timeoout if a passphrase is set in the cookies', () => { |
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.
calls passConfirmSubmit with timeout if a passphrase is set in the cookies
}); | ||
|
||
describe('PassphraseLink', () => { | ||
it('should asign progress to its own $scope', () => { |
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.
should assign progress to its own $scope
src/app/components/login/login.js
Outdated
@@ -11,17 +8,21 @@ app.component('login', { | |||
onLogin: '&', | |||
}, | |||
controller: class login { | |||
constructor($scope, $rootScope, $timeout, $document, $mdDialog, $mdMedia, $cookies, $peers) { | |||
|
|||
/* eslint no-param-reassign: ["error", { "props": false }] */ |
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.