Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Support second passphrase - Closes #21 #145

Merged
merged 32 commits into from
Apr 26, 2017

Conversation

reyraa
Copy link
Contributor

@reyraa 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.

reyraa added 24 commits April 23, 2017 17:59
…ve, - sets generated passphrase as second passphrase
@reyraa reyraa assigned reyraa and unassigned reyraa Apr 25, 2017
@reyraa reyraa added this to the Version 1.0.0 milestone Apr 25, 2017
@karmacoma karmacoma removed this from the Version 1.0.0 milestone Apr 25, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-3.3%) to 84.274% when pulling 919c727 on 21-support-second-passphrase into 625f7bd on development.

@karmacoma karmacoma changed the title Support second passphrase, closes 21 Support second passphrase - Closes #21 Apr 26, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-3.2%) to 84.401% when pulling e602f9e on 21-support-second-passphrase into 126b197 on development.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.8%) to 85.761% when pulling c3ec49e on 21-support-second-passphrase into 126b197 on development.

Copy link
Contributor

@karmacoma karmacoma left a 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.' });
Copy link
Contributor

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.' });
Copy link
Contributor

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.');
Copy link
Contributor

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', () => {
Copy link
Contributor

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')
Copy link
Contributor

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.';
Copy link
Contributor

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', () => {
Copy link
Contributor

@karmacoma karmacoma Apr 26, 2017

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', () => {
Copy link
Contributor

@karmacoma karmacoma Apr 26, 2017

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', () => {
Copy link
Contributor

@karmacoma karmacoma Apr 26, 2017

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

@@ -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 }] */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix indent.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.8%) to 85.761% when pulling d114646 on 21-support-second-passphrase into 126b197 on development.

@karmacoma karmacoma merged commit 61a9eed into development Apr 26, 2017
@karmacoma karmacoma deleted the 21-support-second-passphrase branch April 26, 2017 15:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants