module Devise::Models::Userbin

Public Instance Methods

_userbin_id() click to toggle source

Since the identifier will be used in API routes, it needs to be URI encoded

# File lib/devise_userbin/model.rb, line 33
def _userbin_id
  URI.encode(userbin_id.to_s)
end
destroy_userbin_user() click to toggle source
# File lib/devise_userbin/model.rb, line 11
def destroy_userbin_user
  userbin_user_block do
    ::Userbin::User.destroy_existing(id)
  end
end
userbin_id() click to toggle source

Override this in your Devise model to use a custom identifier for the Userbin API:s

# File lib/devise_userbin/model.rb, line 27
def userbin_id
  id
end
userbin_user_block() { || ... } click to toggle source
# File lib/devise_userbin/model.rb, line 17
def userbin_user_block
  begin
    yield
  rescue ::Userbin::Error
    true
  end
end
valid_for_authentication?() click to toggle source

Overwrites valid_for_authentication? from Devise::Models::Authenticatable for verifying whether a user is allowed to sign in or not.

Calls superclass method
# File lib/devise_userbin/model.rb, line 40
def valid_for_authentication?
  return super unless persisted?

  if super
    true
  else
    # TODO: track unsuccessful login
    false
  end
end