Skip to content

Commit

Permalink
Merge pull request #52 from kaishuu0123/master
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
kaishuu0123 authored Dec 13, 2019
2 parents 2cf84f1 + ae38f3b commit c1e6b71
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/omniauth_finished_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def finish_signup
@provider = params[:provider]

if (request.post? || request.patch?) && @user.update(user_params)
# OAuth の場合には希望アカウントが入力された後にグループを作る
@user.create_default_group
# @user.send_confirmation_instructions unless @user.confirmed?
sign_in(@user, bypass: true)
redirect_to root_url, notice: t('devise.omniauth_callbacks.success', kind: @provider.capitalize)
Expand Down
3 changes: 2 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

class User < ApplicationRecord
rolify
after_commit :create_default_group, on: [:create]
attr_accessor :skip_create_default_group
after_commit :create_default_group, on: [:create], if: Proc.new { skip_create_default_group == false }
after_create :assign_default_role

attr_writer :login
Expand Down
1 change: 1 addition & 0 deletions app/services/o_auth_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def find_or_create_new_user(auth)
email: email ? email : temp_email,
password: Devise.friendly_token[0, 20]
)
user.skip_create_default_group = true
# email確認メール送信を延期するために一時的にemail確認済みの状態にする。
# user.skip_confirmation!
# email仮をデータベースに保存するため、validationを一時的に無効化。
Expand Down

0 comments on commit c1e6b71

Please sign in to comment.