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

Commit

Permalink
chore(verify): remove server side verification
Browse files Browse the repository at this point in the history
  • Loading branch information
vbudhram committed Nov 30, 2018
1 parent c7d332e commit 5485d45
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 455 deletions.
27 changes: 6 additions & 21 deletions app/scripts/models/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,32 +583,17 @@ const Account = Backbone.Model.extend({
* @param {String} code - the verification code
* @param {Object} [options]
* @param {Object} [options.service] - the service issuing signup request
* @param {String} [options.serverVerificationStatus] - the status of server verification
* @returns {Promise} - resolves when complete
*/
verifySignUp (code, options = {}) {
verifySignUp(code, options = {}) {
const marketingOptIn = this.get('needsOptedInToMarketingEmail');
return Promise.resolve()
.then(() => {
if (options.serverVerificationStatus !== 'verified') {
// if server verification was not present or not successful
// then attempt client verification

if (marketingOptIn) {
this.unset('needsOptedInToMarketingEmail');
options.marketingOptIn = true;
}
if (marketingOptIn) {
this.unset('needsOptedInToMarketingEmail');
options.marketingOptIn = true;
}

return this._fxaClient.verifyCode(
this.get('uid'),
code,
options
);
}
})
return this._fxaClient.verifyCode(this.get('uid'), code, options)
.then(() => {
this.set('verified', true);

if (marketingOptIn) {
this._notifier.trigger('flow.initialize');
this._notifier.trigger('flow.event', {
Expand Down
1 change: 0 additions & 1 deletion app/scripts/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ define(function (require, exports, module) {
* @param {String} code - verification code
* @param {Object} [options]
* @param {Object} [options.service] - the service issuing signup request
* @param {String} [options.serverVerificationStatus] - the status of server verification
* @returns {Promise} - resolves with the account when complete
*/
completeAccountSignUp (account, code, options) {
Expand Down
1 change: 0 additions & 1 deletion app/scripts/views/complete_sign_up.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ define(function (require, exports, module) {
primaryEmailVerified: this.getSearchParam('primary_email_verified') || null,
reminder: verificationInfo.get('reminder'),
secondaryEmailVerified: this.getSearchParam('secondary_email_verified') || null,
serverVerificationStatus: this.getSearchParam('server_verification') || null,
service: this.relier.get('service') || null,
type: verificationInfo.get('type')
};
Expand Down
46 changes: 0 additions & 46 deletions app/tests/spec/models/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,48 +1009,6 @@ describe('models/account', function () {
notifier.trigger.resetHistory();
});

describe('with custom server verification value', function () {
beforeEach(function () {
sinon.stub(fxaClient, 'verifyCode').callsFake(function () {
return Promise.resolve();
});
});

it('does not call verifyCode with verified', function () {
account.set('uid', UID);

return account.verifySignUp('CODE', {
serverVerificationStatus: 'verified'
}).then(() => {
assert.isFalse(fxaClient.verifyCode.called);
assert.isTrue(account.get('verified'));
});
});

it('calls verifyCode with other status', function () {
account.set('uid', UID);

return account.verifySignUp('CODE', {
serverVerificationStatus: 'test'
}).then(() => {
assert.isTrue(fxaClient.verifyCode.called);
assert.isTrue(account.get('verified'));
});
});

it('calls verifyCode with undefined status', function () {
account.set('uid', UID);

return account.verifySignUp('CODE', {
serverVerificationStatus: undefined
}).then(() => {
assert.isTrue(fxaClient.verifyCode.called);
assert.isTrue(account.get('verified'));
});
});

});

describe('without email opt-in', function () {
beforeEach(function () {
sinon.stub(fxaClient, 'verifyCode').callsFake(function () {
Expand All @@ -1068,10 +1026,6 @@ describe('models/account', function () {
assert.isTrue(fxaClient.verifyCode.calledWith(UID, 'CODE', options));
});

it('sets the `verified` flag', function () {
assert.isTrue(account.get('verified'));
});

it('did not call notifier.trigger', () => {
assert.equal(notifier.trigger.callCount, 0);
});
Expand Down
34 changes: 0 additions & 34 deletions app/tests/spec/views/complete_sign_up.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ define(function (require, exports, module) {
primaryEmailVerified: null,
reminder: null,
secondaryEmailVerified: null,
serverVerificationStatus: null,
service: validService,
type: null
});
Expand All @@ -253,7 +252,6 @@ define(function (require, exports, module) {
primaryEmailVerified: null,
reminder: validReminder,
secondaryEmailVerified: null,
serverVerificationStatus: null,
service: null,
type: null
});
Expand Down Expand Up @@ -281,41 +279,12 @@ define(function (require, exports, module) {
primaryEmailVerified: null,
reminder: validReminder,
secondaryEmailVerified: null,
serverVerificationStatus: null,
service: validService,
type: null
});
});
});

describe('if server_verification is in the url', function () {
beforeEach(function () {
windowMock.location.search = '?code=' + validCode + '&uid=' + validUid +
'&server_verification=verified';
relier = new Relier({}, {
window: windowMock
});
relier.fetch();
initView(account);
sinon.stub(view, '_notifyBrokerAndComplete').callsFake(() => Promise.resolve());
return view.render();
});

it('attempt to pass server_verification to verifySignUp', function () {
var args = account.verifySignUp.getCall(0).args;
assert.isTrue(account.verifySignUp.called);
assert.ok(args[0]);
assert.deepEqual(args[1], {
primaryEmailVerified: null,
reminder: null,
secondaryEmailVerified: null,
serverVerificationStatus: 'verified',
service: null,
type: null
});
});
});

describe('if type is in the url', function () {
beforeEach(function () {
windowMock.location.search = '?code=' + validCode + '&uid=' + validUid +
Expand All @@ -337,7 +306,6 @@ define(function (require, exports, module) {
primaryEmailVerified: null,
reminder: null,
secondaryEmailVerified: null,
serverVerificationStatus: null,
service: null,
type: 'secondary'
});
Expand Down Expand Up @@ -366,7 +334,6 @@ define(function (require, exports, module) {
primaryEmailVerified: null,
reminder: null,
secondaryEmailVerified: 'some@email.com',
serverVerificationStatus: null,
service: null,
type: null
});
Expand Down Expand Up @@ -394,7 +361,6 @@ define(function (require, exports, module) {
primaryEmailVerified: 'some@email.com',
reminder: null,
secondaryEmailVerified: null,
serverVerificationStatus: null,
service: null,
type: null
});
Expand Down
2 changes: 0 additions & 2 deletions server/lib/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ module.exports = function (config, i18n) {
redirectVersionedToUnversioned('complete_reset_password'),
redirectVersionedToUnversioned('reset_password'),
redirectVersionedToUnversioned('verify_email'),
// Disable server verification for now due to issues with customs
//require('./routes/get-verify-email')(),
require('./routes/get-apple-app-site-association')(),
require('./routes/get-frontend')(),
require('./routes/get-terms-privacy')(i18n),
Expand Down
118 changes: 0 additions & 118 deletions server/lib/routes/get-verify-email.js

This file was deleted.

0 comments on commit 5485d45

Please sign in to comment.