hackatime/app/models/oauth_application.rb
Echo 55c8f5b926
Oauth apps for all! (#810)
* linting

* migrations

* user modelassss

* controllers

* views and shii

* fix bad input on seeds

* fix intenting

* DRY!!!
2026-01-19 22:24:21 -05:00

19 lines
447 B
Ruby

class OauthApplication < Doorkeeper::Application
belongs_to :owner, polymorphic: true, optional: true
scope :verified, -> { where(verified: true) }
scope :unverified, -> { where(verified: false) }
attr_accessor :admin_bypass
validate :locked_name, on: :update
private
def locked_name
return if admin_bypass
return unless verified? && name_changed?
errors.add(:name, "cannot be changed for verified apps")
end
end