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
d07a2798
Commit
d07a2798
authored
Jul 08, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8815 from open-craft/hinted-login-fix
Fix hinted login view to be compatible with secondary providers.
parents
ea36fcac
f4c8d8fa
Hide 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 @
d07a2798
...
@@ -28,15 +28,23 @@ define([
...
@@ -28,15 +28,23 @@ define([
loginUrl
:
'/auth/login/facebook/?auth_entry=account_login'
,
loginUrl
:
'/auth/login/facebook/?auth_entry=account_login'
,
registerUrl
:
'/auth/login/facebook/?auth_entry=account_register'
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
// Initialize the login view
view
=
new
HintedLoginView
({
view
=
new
HintedLoginView
({
thirdPartyAuth
:
THIRD_PARTY_AUTH
,
thirdPartyAuth
:
THIRD_PARTY_AUTH
,
hintedProvider
:
HINTED_PROVIDER
,
hintedProvider
:
hintedProvider
,
platformName
:
PLATFORM_NAME
platformName
:
PLATFORM_NAME
});
});
...
@@ -52,15 +60,23 @@ define([
...
@@ -52,15 +60,23 @@ define([
});
});
it
(
'displays a choice as two buttons'
,
function
()
{
it
(
'displays a choice as two buttons'
,
function
()
{
createHintedLoginView
(
this
);
createHintedLoginView
(
"oa2-google-oauth2"
);
expect
(
$
(
'.proceed-button.button-oa2-google-oauth2'
)).
toBeVisible
();
expect
(
$
(
'.proceed-button.button-oa2-google-oauth2'
)).
toBeVisible
();
expect
(
$
(
'.form-toggle'
)).
toBeVisible
();
expect
(
$
(
'.form-toggle'
)).
toBeVisible
();
expect
(
$
(
'.proceed-button.button-oa2-facebook'
)).
not
.
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
()
{
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
// Click the "Yes, proceed" button
$
(
'.proceed-button'
).
click
();
$
(
'.proceed-button'
).
click
();
...
...
lms/static/js/student_account/views/HintedLoginView.js
View file @
d07a2798
...
@@ -19,18 +19,14 @@ var edx = edx || {};
...
@@ -19,18 +19,14 @@ var edx = edx || {};
initialize
:
function
(
data
)
{
initialize
:
function
(
data
)
{
this
.
tpl
=
$
(
this
.
tpl
).
html
();
this
.
tpl
=
$
(
this
.
tpl
).
html
();
this
.
providers
=
data
.
thirdPartyAuth
.
providers
||
[];
this
.
hintedProvider
=
(
this
.
hintedProvider
=
_
.
findWhere
(
this
.
providers
,
{
id
:
data
.
hintedProvider
})
_
.
findWhere
(
data
.
thirdPartyAuth
.
providers
,
{
id
:
data
.
hintedProvider
})
||
this
.
platformName
=
data
.
platformName
;
_
.
findWhere
(
data
.
thirdPartyAuth
.
secondaryProviders
,
{
id
:
data
.
hintedProvider
})
);
},
},
render
:
function
()
{
render
:
function
()
{
$
(
this
.
el
).
html
(
_
.
template
(
this
.
tpl
,
{
$
(
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
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