mirror of
https://github.com/System-End/stickers.git
synced 2026-04-19 22:05:10 +00:00
17 lines
375 B
Ruby
17 lines
375 B
Ruby
# frozen_string_literal: true
|
|
|
|
class User < ApplicationRecord
|
|
validates :uid, presence: true, uniqueness: true
|
|
|
|
def self.from_omniauth(auth)
|
|
find_or_create_by(uid: auth.uid) do |user|
|
|
user.email = auth.info.email
|
|
user.name = auth.info.name
|
|
user.slack_id = auth.extra&.raw_info&.slack_id
|
|
end
|
|
end
|
|
|
|
def identifier
|
|
slack_id || uid
|
|
end
|
|
end
|