|
|
@ -8,22 +8,20 @@ module Devise |
|
|
|
::Devise::Models.config(self, :login_code_random_pattern, :max_login_attempts) |
|
|
|
::Devise::Models.config(self, :login_code_random_pattern, :max_login_attempts) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
module InstanceMethods |
|
|
|
def need_two_factor_authentication? |
|
|
|
def need_two_factor_authentication? |
|
|
|
true |
|
|
|
true |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_two_factor_code |
|
|
|
def generate_two_factor_code |
|
|
|
self.class.login_code_random_pattern.gen |
|
|
|
self.class.login_code_random_pattern.gen |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def send_two_factor_authentication_code(code) |
|
|
|
def send_two_factor_authentication_code(code) |
|
|
|
p "Code is #{code}" |
|
|
|
p "Code is #{code}" |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def max_login_attempts? |
|
|
|
def max_login_attempts? |
|
|
|
second_factor_attempts_count >= self.class.max_login_attempts |
|
|
|
second_factor_attempts_count >= self.class.max_login_attempts |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|