Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
f4c8d8fa
Commit
f4c8d8fa
authored
Jul 07, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix hinted login view to be compatible with secondary providers.
parent
dbc470ab
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
lms/static/js/spec/student_account/hinted_login_spec.js
+22
-6
lms/static/js/student_account/views/HintedLoginView.js
+4
-8
No files found.
lms/static/js/spec/student_account/hinted_login_spec.js
View file @
f4c8d8fa
...
...
@@ -28,15 +28,23 @@ define([
loginUrl
:
'/auth/login/facebook/?auth_entry=account_login'
,
registerUrl
:
'/auth/login/facebook/?auth_entry=account_register'
}
],
secondaryProviders
:
[
{
id
:
'saml-harvard'
,
name
:
'Harvard'
,
iconClass
:
'fa-university'
,
loginUrl
:
'/auth/login/tpa-saml/?auth_entry=account_login&idp=harvard'
,
registerUrl
:
'/auth/login/tpa-saml/?auth_entry=account_register&idp=harvard'
}
]
},
HINTED_PROVIDER
=
"oa2-google-oauth2"
;
};
var
createHintedLoginView
=
function
(
test
)
{
var
createHintedLoginView
=
function
(
hintedProvider
)
{
// Initialize the login view
view
=
new
HintedLoginView
({
thirdPartyAuth
:
THIRD_PARTY_AUTH
,
hintedProvider
:
HINTED_PROVIDER
,
hintedProvider
:
hintedProvider
,
platformName
:
PLATFORM_NAME
});
...
...
@@ -52,15 +60,23 @@ define([
});
it
(
'displays a choice as two buttons'
,
function
()
{
createHintedLoginView
(
this
);
createHintedLoginView
(
"oa2-google-oauth2"
);
expect
(
$
(
'.proceed-button.button-oa2-google-oauth2'
)).
toBeVisible
();
expect
(
$
(
'.form-toggle'
)).
toBeVisible
();
expect
(
$
(
'.proceed-button.button-oa2-facebook'
)).
not
.
toBeVisible
();
});
it
(
'works with secondary providers as well'
,
function
()
{
createHintedLoginView
(
"saml-harvard"
);
expect
(
$
(
'.proceed-button.button-saml-harvard'
)).
toBeVisible
();
expect
(
$
(
'.form-toggle'
)).
toBeVisible
();
expect
(
$
(
'.proceed-button.button-oa2-google-oauth2'
)).
not
.
toBeVisible
();
});
it
(
'redirects the user to the hinted provider if the user clicks the proceed button'
,
function
()
{
createHintedLoginView
(
this
);
createHintedLoginView
(
"oa2-google-oauth2"
);
// Click the "Yes, proceed" button
$
(
'.proceed-button'
).
click
();
...
...
lms/static/js/student_account/views/HintedLoginView.js
View file @
f4c8d8fa
...
...
@@ -19,18 +19,14 @@ var edx = edx || {};
initialize
:
function
(
data
)
{
this
.
tpl
=
$
(
this
.
tpl
).
html
();
this
.
providers
=
data
.
thirdPartyAuth
.
providers
||
[];
this
.
hintedProvider
=
_
.
findWhere
(
this
.
providers
,
{
id
:
data
.
hintedProvider
})
this
.
platformName
=
data
.
platformName
;
this
.
hintedProvider
=
(
_
.
findWhere
(
data
.
thirdPartyAuth
.
providers
,
{
id
:
data
.
hintedProvider
})
||
_
.
findWhere
(
data
.
thirdPartyAuth
.
secondaryProviders
,
{
id
:
data
.
hintedProvider
})
);
},
render
:
function
()
{
$
(
this
.
el
).
html
(
_
.
template
(
this
.
tpl
,
{
// We pass the context object to the template so that
// we can perform variable interpolation using sprintf
providers
:
this
.
providers
,
platformName
:
this
.
platformName
,
hintedProvider
:
this
.
hintedProvider
}));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment