Skip to content

Commit

Permalink
google_access_token propagation and username setting fixes #4187
Browse files Browse the repository at this point in the history
  • Loading branch information
juanignaciosl committed Jul 31, 2015
1 parent aa02150 commit 4a6d720
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/controllers/signup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ def create
@user = ::User.new_with_organization(@organization)

if params[:google_access_token].present? && @google_plus_config.present?
# Keep in mind get_user_data can return nil
user_data = GooglePlusAPI.new.get_user_data(params[:google_access_token])
end

if user_data
user_data.set_values(@user)
if params[:user] && params[:user][:username].present?
@user.username = params[:user][:username]
end
else
@user.username = params[:user][:username]
@user.email = params[:user][:email]
Expand Down
4 changes: 2 additions & 2 deletions app/views/signup/signup.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<% end %>
<%= form_for @user, url: CartoDB.url(self, 'signup_organization_user'), html: { class: "js-Loading-form" } do |f| %>
<input type="hidden" value="" id="google_access_token" name="google_access_token" />
<input type="hidden" value="<%= params[:google_access_token] %>" id="google_access_token" name="google_access_token" />
<input type="hidden" value="0" id="google_access_filled" name="google_access_filled" />

<div class="Sessions-fieldsGorup">
Expand Down Expand Up @@ -207,4 +207,4 @@
</div>
</div>
</footer>
</div>
</div>

0 comments on commit 4a6d720

Please sign in to comment.