Commit 0b9ed031 by AlasdairSwan

ECOM-369 Styled third party auth buttons and cleaned up third party auth messaging

parent 3efeaf5a
...@@ -24,6 +24,8 @@ var edx = edx || {}; ...@@ -24,6 +24,8 @@ var edx = edx || {};
preRender: function( data ) { preRender: function( data ) {
this.providers = data.thirdPartyAuth.providers || []; this.providers = data.thirdPartyAuth.providers || [];
this.currentProvider = data.thirdPartyAuth.currentProvider || ''; this.currentProvider = data.thirdPartyAuth.currentProvider || '';
console.log(data);
}, },
render: function( html ) { render: function( html ) {
...@@ -64,6 +66,7 @@ var edx = edx || {}; ...@@ -64,6 +66,7 @@ var edx = edx || {};
thirdPartyAuth: function( event ) { thirdPartyAuth: function( event ) {
var providerUrl = $(event.target).data('provider-url') || ''; var providerUrl = $(event.target).data('provider-url') || '';
if (providerUrl) { if (providerUrl) {
window.location.href = providerUrl; window.location.href = providerUrl;
} else { } else {
...@@ -73,8 +76,9 @@ var edx = edx || {}; ...@@ -73,8 +76,9 @@ var edx = edx || {};
}, },
saveError: function( error ) { saveError: function( error ) {
console.log(error.status, ' error: ', error.responseText); // console.log(error.status, ' error: ', error.responseText);
this.errors = ['<li>' + error.responseText + '</li>']; this.errors = ['<li>' + error.responseText + '</li>'];
this.setErrors();
/* If we've gotten a 403 error, it means that we've successfully /* If we've gotten a 403 error, it means that we've successfully
* authenticated with a third-party provider, but we haven't * authenticated with a third-party provider, but we haven't
...@@ -89,7 +93,6 @@ var edx = edx || {}; ...@@ -89,7 +93,6 @@ var edx = edx || {};
// TODO -- display the error // TODO -- display the error
} }
this.setErrors();
} }
}); });
......
...@@ -220,6 +220,45 @@ ...@@ -220,6 +220,45 @@
text-transform: none; text-transform: none;
} }
.login-provider {
@extend %btn-secondary-blue-outline;
width: 100%;
margin-top: 20px;
.icon {
color: inherit;
margin-right: $baseline/2;
}
&.button-Google:hover, &.button-Google:focus {
background-color: #dd4b39;
border: 1px solid #A5382B;
}
&.button-Google:hover {
box-shadow: 0 2px 1px 0 #8D3024;
}
&.button-Facebook:hover, &.button-Facebook:focus {
background-color: #3b5998;
border: 1px solid #263A62;
}
&.button-Facebook:hover {
box-shadow: 0 2px 1px 0 #30487C;
}
&.button-LinkedIn:hover , &.button-LinkedIn:focus {
background-color: #0077b5;
border: 1px solid #06527D;
}
&.button-LinkedIn:hover {
box-shadow: 0 2px 1px 0 #005D8E;
}
}
/** Error Container - from _account.scss **/ /** Error Container - from _account.scss **/
.status { .status {
@include box-sizing(border-box); @include box-sizing(border-box);
...@@ -348,5 +387,17 @@ ...@@ -348,5 +387,17 @@
width: 100px; width: 100px;
} }
} }
.login-provider {
width: calc( 50% - 12px );
&:nth-child(odd) {
margin-left: 10px;
}
&:nth-child(even) {
margin-right: 10px;
}
}
} }
} }
...@@ -3,11 +3,6 @@ ...@@ -3,11 +3,6 @@
<h4 class="message-title">We couldn't log you in.</h4> <h4 class="message-title">We couldn't log you in.</h4>
<ul class="message-copy"></ul> <ul class="message-copy"></ul>
</div> </div>
<div class="already-authenticated-msg hidden" aria-hidden="true">
<% if (currentProvider) { %>
<p class="instructions">You've successfully logged into <%- currentProvider %>, but you need to link your account. Please click "I am a returning user" to create an EdX account.</p>
<% } %>
</div>
<%= fields %> <%= fields %>
<button class="action action-primary action-update js-login">Log in</button> <button class="action action-primary action-update js-login">Log in</button>
</form> </form>
......
<% if (currentProvider) { %> <% if (currentProvider) { %>
<p class="instructions"> <div class="status submission-success" aria-hidden="false">
You've successfully signed in with <strong><%- currentProvider %></strong>.<br /> <h4 class="message-title">You've successfully signed in with <strong><%- currentProvider %></strong>.</h4>
We just need a little more information before you start learning with edX. <ul class="message-copy">
</p> <li>We just need a little more information before you start learning with edX.</li>
</ul>
</div>
<% } else { <% } else {
_.each( providers, function( provider) { %> _.each( providers, function( provider) { %>
<button type="submit"class="button button-primary button-<%- provider.name %> login-provider" data-provider-url="<%- provider.registerUrl %>"> <button type="submit"class="button button-primary button-<%- provider.name %> login-provider" data-provider-url="<%- provider.registerUrl %>">
......
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