Fixed bug #2675: Follow up to 9503ff20ce
- Linking auth provider account from profile fails.
This commit is contained in:
parent
ec8b7b5be1
commit
0cdc3ffb7b
2 changed files with 13 additions and 3 deletions
|
@ -2,6 +2,7 @@ class Index extends App.ControllerSubContent
|
||||||
requiredPermission: 'user_preferences.linked_accounts'
|
requiredPermission: 'user_preferences.linked_accounts'
|
||||||
header: 'Linked Accounts'
|
header: 'Linked Accounts'
|
||||||
events:
|
events:
|
||||||
|
'click .js-add': 'add'
|
||||||
'click .js-remove': 'remove'
|
'click .js-remove': 'remove'
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
@ -20,6 +21,11 @@ class Index extends App.ControllerSubContent
|
||||||
auth_providers: auth_providers
|
auth_providers: auth_providers
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add: (e) =>
|
||||||
|
e.preventDefault()
|
||||||
|
key = $(e.target).data('key')
|
||||||
|
@el.find(".js-addForm-#{key}").submit()
|
||||||
|
|
||||||
remove: (e) =>
|
remove: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
provider = $(e.target).data('provider')
|
provider = $(e.target).data('provider')
|
||||||
|
|
|
@ -7,12 +7,16 @@
|
||||||
<ul>
|
<ul>
|
||||||
<% for key, provider of @auth_providers: %>
|
<% for key, provider of @auth_providers: %>
|
||||||
<li> <%- @T( provider.name ) %>
|
<li> <%- @T( provider.name ) %>
|
||||||
<% if !@user['accounts'] || !@user['accounts'][key]: %><a href="<%= provider.url %>">
|
<% if !@user['accounts'] || !@user['accounts'][key]: %>
|
||||||
<%- @T('Add') %></a>
|
<form method="post" class="hidden js-addForm-<%= key %>" action="<%= provider.url %>">
|
||||||
|
<input type="hidden" name="authenticity_token" value="<%= Spine.Ajax.defaults.headers['X-CSRF-Token'] %>">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<a href="#" data-key="<%= key %>" class="js-add"><%- @T('Add') %></a>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
"<%= @user['accounts'][key]['username'] %>" <a href="#" data-uid="<%= @user['accounts'][key]['uid'] %>" data-provider="<%= key %>" class="js-remove"><%- @T('remove') %></a>
|
"<%= @user['accounts'][key]['username'] %>" <a href="#" data-uid="<%= @user['accounts'][key]['uid'] %>" data-provider="<%= key %>" class="js-remove"><%- @T('remove') %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue