Commit 64a96124 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #524 from hypothesis/deprecate-openloginform

Deprecate openLoginForm setting and make a no-op when using OAuth
parents 40bd6663 0570fa96
......@@ -64,6 +64,11 @@ loads.
startup, as if the user had clicked "Log in" themselves.
(Default: ``false``.)
.. warning::
This option is deprecated and has no effect when the client is using OAuth
for authorization.
.. option:: openSidebar
``Boolean``. Controls whether the sidebar opens automatically on startup.
......
......@@ -76,7 +76,7 @@ function HypothesisAppController(
// after first install of the extension.
self.auth = authStateFromUserID(state.userid);
if (!state.userid && settings.openLoginForm) {
if (!state.userid && settings.openLoginForm && !auth.login) {
self.login();
}
});
......
......@@ -7,7 +7,7 @@ var events = require('../../events');
var bridgeEvents = require('../../../shared/bridge-events');
var util = require('../../../shared/test/util');
describe('hypothesisApp', function () {
describe('sidebar.components.hypothesis-app', function () {
var $componentController = null;
var $scope = null;
var $rootScope = null;
......@@ -158,7 +158,7 @@ describe('hypothesisApp', function () {
sandbox.restore();
});
describe('isSidebar property', function () {
describe('#isSidebar', function () {
it('is false if the window is the top window', function () {
fakeWindow.top = fakeWindow;
......@@ -264,6 +264,27 @@ describe('hypothesisApp', function () {
assert.calledOnce(fakeRoute.reload);
});
context('when the "openLoginForm" setting is enabled', () => {
beforeEach(() => {
fakeSettings.openLoginForm = true;
});
it('shows the login form if not using OAuth', () => {
var ctrl = createController();
return fakeSession.load().then(() => {
assert.isTrue(ctrl.accountDialog.visible);
});
});
it('does not show the login form if using OAuth', () => {
fakeAuth.login = sandbox.stub();
var ctrl = createController();
return fakeSession.load().then(() => {
assert.isFalse(ctrl.accountDialog.visible);
});
});
});
describe('#signUp', function () {
it('tracks sign up requests in analytics', function () {
var ctrl = createController();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment