app/models/ibrain/auth/user.rb in ibrain-auth-0.3.3 vs app/models/ibrain/auth/user.rb in ibrain-auth-0.3.4

- old
+ new

@@ -28,10 +28,14 @@ } super.merge({ 'role' => role }, hasura_keys) end + def can_skip_confirmation? + try(:is_admin?) || email.blank? + end + class << self def ibrain_find(params, available_columns) matched_value = params[:username] || params[:email] if matched_value.present? @@ -51,14 +55,17 @@ create!(params) end def create_with_line!(params) - created!({ + user = created!({ uid: params['uid'], provider: 'line', remote_avatar_url: params['info']['image'] }) + + user.skip_confirmation! unless user&.confirmed? + user end end end end end