Add login buttons to create account template.

This commit is contained in:
Robin Ward 2014-08-14 12:51:16 -04:00
parent 649329e420
commit a0d0f859ba
7 changed files with 30 additions and 8 deletions

View File

@ -0,0 +1,16 @@
export default Ember.Component.extend({
elementId: 'login-buttons',
classNameBindings: ['hidden'],
hidden: Em.computed.equal('buttons.length', 0),
buttons: function() {
return Em.get('Discourse.LoginMethod.all');
}.property(),
actions: {
externalLogin: function(provider) {
this.sendAction('action', provider);
}
}
});

View File

@ -3,6 +3,8 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality';
import DiscourseController from 'discourse/controllers/controller';
export default DiscourseController.extend(ModalFunctionality, {
needs: ['login'],
uniqueUsernameValidation: null,
globalNicknameExists: false,
complete: false,
@ -323,6 +325,10 @@ export default DiscourseController.extend(ModalFunctionality, {
tosAcceptRequired: Discourse.computed.setting('tos_accept_required'),
actions: {
externalLogin: function(provider) {
this.get('controllers.login').send('externalLogin', provider);
},
createAccount: function() {
var self = this;
this.set('formSubmitted', true);

View File

@ -0,0 +1,3 @@
{{#each buttons}}
<button {{bind-attr class=":btn :btn-social name"}} {{action externalLogin this}}>{{title}}</button>
{{/each}}

View File

@ -1,5 +1,7 @@
{{#unless complete}}
<div class="modal-body">
{{login-buttons action="externalLogin"}}
<div>
<form>
<table>

View File

@ -1,11 +1,5 @@
<div class="modal-body">
{{#if hasAtLeastOneLoginButton}}
<div id="login-buttons">
{{#each Discourse.LoginMethod.all}}
<button class="btn btn-social {{unbound name}}" {{action externalLogin this}}>{{unbound title}}</button>
{{/each}}
</div>
{{/if}}
{{login-buttons action="externalLogin"}}
{{#if Discourse.SiteSettings.enable_local_logins}}
{{#if hasAtLeastOneLoginButton}}
<h3 style="text-align:center; margin-bottom:10px;">{{i18n login.or}}</h3>

View File

@ -20,6 +20,7 @@
//= require ./discourse/models/composer
//= require ./discourse/models/topic
//= require ./discourse/controllers/controller
//= require ./discourse/controllers/discovery-sortable
//= require ./discourse/controllers/object
//= require ./discourse/controllers/navigation/default
//= require ./discourse/views/modal_body_view

View File

@ -1,5 +1,5 @@
moduleFor("controller:create-account", "controller:create-account", {
needs: ['controller:modal']
needs: ['controller:modal', 'controller:login']
});
test('basicUsernameValidation', function() {