Sha256: be864cef0e65b0a9fbdb90675f009b1353ae9672fe87d919e545b88d580c5a40
Contents?: true
Size: 569 Bytes
Versions: 8
Compression:
Stored size: 569 Bytes
Contents
module Nyauth class Session include ActiveModel::Model attr_reader :email, :password, :client def initialize(service_params = {}) @email = service_params[:email] @password = service_params[:password] end def save(options = {}) options.reverse_merge!(as: :user) klass = options[:as].to_s.classify.constantize @client = klass.authenticate(email, password) errors.add(:base, :invalid_email_or_password) unless @client client rescue errors.add(:base, :invalid_email_or_password) end end end
Version data entries
8 entries across 8 versions & 1 rubygems