Sha256: e4eb309a2eea32c7a295bd7e066fb0d7c236ea739f9eb4c6e8b36fd931f5de82
Contents?: true
Size: 768 Bytes
Versions: 5
Compression:
Stored size: 768 Bytes
Contents
require 'devise/strategies/authenticatable' module Devise module Strategies class SubdomainLogin < Authenticatable def subdomain request.subdomain end def valid? subdomain.present? && params["user"] end def authenticate! return fail!('Invalid email or password.') unless account = Mtdevise::Account.find_by(subdomain: subdomain) return fail!('Invalid email or password.') unless user = account.users.find_by(email: params["user"]["email"]) return fail!('Invalid email or password.') unless user.valid_password?(params["user"]["password"]) success! user end end end end Warden::Strategies.add(:subdomain_login, Devise::Strategies::SubdomainLogin)
Version data entries
5 entries across 5 versions & 1 rubygems