module Devise::Models::Lockable::ClassMethods

def unlock_access_by_token(unlock_token)

Options must have the unlock_token
If the user is not locked, creates an error for the user
If no user is found, returns a new user with an error.
Find a user by its unlock token and try to unlock it.
def unlock_access_by_token(unlock_token)
  lockable = find_or_initialize_with_error_by(:unlock_token, unlock_token)
  lockable.unlock_access! if lockable.persisted?
  lockable
end