Skip to content

Commit 712ab41

Browse files
authored
Merge pull request #425 from nypublicradio/mwalsh/MEM-132
MEM-132 Remove facebook login/signup
2 parents e9e4c11 + d84bcb6 commit 712ab41

File tree

5 files changed

+8
-134
lines changed

5 files changed

+8
-134
lines changed

app/templates/login.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
{{nypr-account-forms/login
1212
siteName='WQXR'
13-
showSocialLogin=true
13+
showSocialLogin=false
1414
authAPI=config.authAPI}}
1515
{{/account-wrapper}}

app/templates/signup.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
givenName=first
1313
familyName=last
1414
email=email
15-
showSocialSignup=true
15+
showSocialSignup=false
1616
authAPI=config.authAPI}}
1717
{{/account-wrapper}}

app/templates/verify.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="alert alert-success">Please log in to verify your email.</div>
1212
{{nypr-account-forms/login
1313
siteName='WQXR'
14-
showSocialLogin=true
14+
showSocialLogin=false
1515
authAPI=config.authAPI}}
1616
{{/if}}
1717
{{/account-wrapper}}

tests/acceptance/login-test.js

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import {
1717
currentSession
1818
} from 'ember-simple-auth/test-support';
1919
//import 'wqxr-web-client/tests/helpers/with-feature';
20-
import dummySuccessProviderFb from 'wqxr-web-client/tests/helpers/torii-dummy-success-provider-fb';
21-
import { registerMockOnInstance } from 'wqxr-web-client/tests/helpers/register-mock';
2220

2321
module('Acceptance | login', function(hooks) {
2422
setupApplicationTest(hooks);
@@ -135,70 +133,8 @@ module('Acceptance | login', function(hooks) {
135133

136134
});
137135

138-
test('Log in with Facebook button is visible at load', async function(assert) {
136+
test('Log in with Facebook button is not visible at load', async function(assert) {
139137
await visit('/login');
140-
assert.ok(find('button'));
141-
});
142-
143-
test('Successful facebook login redirects', async function(assert) {
144-
server.create('bucket', {slug: 'wqxr-home'});
145-
server.create('django-page', {id: '/'});
146-
let user = server.create('user', 'facebook');
147-
let facebookProvider = this.owner.lookup('torii-provider:facebook-connect');
148-
this.stub(facebookProvider, 'open').resolves({
149-
accessToken: 'abcdef',
150-
expiresIn: 6000,
151-
userId: '123456',
152-
provider: 'facebook-connect'
153-
});
154-
await visit('/login');
155-
156-
await click('button');
157-
158-
assert.equal(currentURL(), '/');
159-
assert.ok(currentSession().get('isAuthenticated'), 'Session is authenticated');
160-
assert.equal(find('.user-nav-greeting').textContent.trim(), user.given_name);
161-
assert.equal(find('.user-nav-avatar > img').getAttribute('src'), user.picture);
162-
});
163-
164-
test('Facebook login with no email shows alert', async function(assert) {
165-
server.create('user');
166-
registerMockOnInstance(this.owner, 'torii-provider:facebook-connect', dummySuccessProviderFb);
167-
server.get('/v1/session', () => {
168-
return new Response(400, {}, { "errors": {
169-
"code": "MissingAttributeException",
170-
"message": "A provider account could not be created because one or more attributes were not available from the provider. Permissions may have been declined.",
171-
"values": ["email"] }
172-
});
173-
});
174-
175-
let facebookProvider = this.owner.lookup('torii-provider:facebook-connect');
176-
this.stub(facebookProvider, 'open').resolves({
177-
accessToken: 'abcdef',
178-
expiresIn: 6000,
179-
userId: '123456',
180-
provider: 'facebook-connect'
181-
});
182-
183-
await visit('/login');
184-
185-
await click('button');
186-
187-
assert.equal(currentURL(), '/login');
188-
assert.equal(find('.alert-warning').textContent.trim(), "Unfortunately, we can't authorize your account without permission to view your email address.");
189-
assert.ok(!currentSession(this.application).get('isAuthenticated'), 'Session is not authenticated');
190-
});
191-
192-
test('Unsuccessful facebook login shows alert', async function(assert) {
193-
let facebookProvider = this.owner.lookup('torii-provider:facebook-connect');
194-
this.stub(facebookProvider, 'open').rejects({});
195-
196-
await visit('/login');
197-
198-
await click('button');
199-
200-
assert.equal(currentURL(), '/login');
201-
assert.equal(find('.alert-warning').textContent.trim(), "We're sorry, but we weren't able to log you in through Facebook.");
202-
assert.ok(!currentSession(this.application).get('isAuthenticated'), 'Session is not authenticated');
138+
assert.notOk(find('button.account-form-btn--facebook'));
203139
});
204140
});

tests/acceptance/signup-test.js

Lines changed: 3 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ import {
33
click,
44
fillIn,
55
currentURL,
6-
currentRouteName,
76
visit
87
} from '@ember/test-helpers';
98
import { module } from 'qunit';
109
import test from 'ember-sinon-qunit/test-support/test';
1110
import { setupApplicationTest } from 'ember-qunit';
12-
import { Response } from 'ember-cli-mirage';
1311
//import 'wqxr-web-client/tests/helpers/with-feature';
1412
import {
15-
authenticateSession,
16-
currentSession
13+
authenticateSession
1714
} from 'ember-simple-auth/test-support';
1815

1916

@@ -75,67 +72,8 @@ module('Acceptance | signup', function(hooks) {
7572
assert.equal(find('.account-form-heading').textContent.trim(), 'Thanks for signing up!');
7673
});
7774

78-
test('Sign up with Facebook button is visible at load', async function(assert) {
75+
test('Sign up with Facebook button is not visible at load', async function(assert) {
7976
await visit(signupUrl);
80-
assert.ok(find('button.account-form-btn--facebook'));
81-
82-
});
83-
84-
test('Successful facebook login redirects', async function(assert) {
85-
server.create('bucket', {slug: 'wqxr-home'});
86-
let user = server.create('user', 'facebook');
87-
let facebookProvider = this.owner.lookup('torii-provider:facebook-connect');
88-
this.stub(facebookProvider, 'open').resolves({
89-
accessToken: 'abcdef',
90-
expiresIn: 6000,
91-
userId: '123456',
92-
provider: 'facebook-connect'
93-
});
94-
95-
await visit(signupUrl);
96-
await click('button');
97-
98-
assert.ok(/^index(_loading)?$/.test(currentRouteName()));
99-
assert.ok(currentSession().get('isAuthenticated'), 'Session is authenticated');
100-
assert.equal(find('.user-nav-greeting').textContent.trim(), user.given_name);
101-
assert.equal(find('.user-nav-avatar > img').getAttribute('src'), user.picture);
102-
});
103-
104-
test('Facebook login with no email shows alert', async function(assert) {
105-
server.create('user');
106-
let facebookProvider = this.owner.lookup('torii-provider:facebook-connect');
107-
this.stub(facebookProvider, 'open').resolves({
108-
accessToken: 'abcdef',
109-
expiresIn: 6000,
110-
userId: '123456',
111-
provider: 'facebook-connect'
112-
});
113-
server.get('/v1/session', () => {
114-
return new Response(400, {}, { "errors": {
115-
"code": "MissingAttributeException",
116-
"message": "A provider account could not be created because one or more attributes were not available from the provider. Permissions may have been declined.",
117-
"values": ["email"] }
118-
});
119-
});
120-
121-
await visit(signupUrl);
122-
123-
await click('button');
124-
125-
assert.equal(currentURL(), '/signup');
126-
assert.equal(find('.alert-warning').textContent.trim(), "Unfortunately, we can't authorize your account without permission to view your email address.");
127-
assert.ok(!currentSession().get('isAuthenticated'), 'Session is not authenticated');
128-
});
129-
130-
test('Unsuccessful facebook login shows alert', async function(assert) {
131-
let facebookProvider = this.owner.lookup('torii-provider:facebook-connect');
132-
this.stub(facebookProvider, 'open').rejects();
133-
134-
await visit(signupUrl);
135-
await click('button');
136-
137-
assert.equal(currentURL(), '/signup');
138-
assert.equal(find('.alert-warning').textContent.trim(), "We're sorry, but we weren't able to log you in through Facebook.");
139-
assert.ok(!currentSession().get('isAuthenticated'), 'Session is not authenticated');
77+
assert.notOk(find('button.account-form-btn--facebook'));
14078
});
14179
});

0 commit comments

Comments
 (0)