Module: Redmine::Twofa
- Defined in:
- lib/redmine/twofa.rb,
lib/redmine/twofa/base.rb,
lib/redmine/twofa/totp.rb
Defined Under Namespace
Class Method Summary collapse
- .available_schemes ⇒ Object
- .for_twofa_scheme(name) ⇒ Object
- .for_user(user) ⇒ Object
- .register_scheme(name, klass) ⇒ Object
- .unpair_all! ⇒ Object
Class Method Details
.available_schemes ⇒ Object
27 28 29 |
# File 'lib/redmine/twofa.rb', line 27 def self.available_schemes schemes.keys end |
.for_twofa_scheme(name) ⇒ Object
31 32 33 |
# File 'lib/redmine/twofa.rb', line 31 def self.for_twofa_scheme(name) schemes[name] end |
.for_user(user) ⇒ Object
35 36 37 |
# File 'lib/redmine/twofa.rb', line 35 def self.for_user(user) for_twofa_scheme(user.twofa_scheme).try(:new, user) end |
.register_scheme(name, klass) ⇒ Object
22 23 24 25 |
# File 'lib/redmine/twofa.rb', line 22 def self.register_scheme(name, klass) initialize_schemes @@schemes[name] = klass end |
.unpair_all! ⇒ Object
39 40 41 42 |
# File 'lib/redmine/twofa.rb', line 39 def self.unpair_all! users = User.where.not(twofa_scheme: nil) users.each {|u| self.for_user(u).destroy_pairing_without_verify!} end |