lib/ditty/policies/identity_policy.rb in ditty-0.6.0 vs lib/ditty/policies/identity_policy.rb in ditty-0.7.0.pre.rc1
- old
+ new
@@ -2,11 +2,19 @@
require 'ditty/policies/application_policy'
module Ditty
class IdentityPolicy < ApplicationPolicy
- def register?
- !['1', 1, 'true', true, 'yes'].include? ENV['DITTY_REGISTERING_DISABLED']
+ def login?
+ true
+ end
+
+ def forgot_password?
+ true
+ end
+
+ def reset_password?
+ record.new? || (record.reset_requested && record.reset_requested > (Time.now - (24 * 60 * 60)))
end
def permitted_attributes
%i[username password password_confirmation]
end