Sha256: 249849665c93da6b32a60cdd3392605bc19d8ad58cec0b1cf9804a4938cadb7c

Contents?: true

Size: 453 Bytes

Versions: 17

Compression:

Stored size: 453 Bytes

Contents

Warden::Strategies.add(:password) do
	def subdomain
		ActionDispatch::Http::URL.extract_subdomains(request.host, 1)
	end

	def valid?
		subdomain.present? && params["user"]
	end

	def authenticate!
		return fail! unless account = Mtwarden::Account.find_by(subdomain: subdomain)
		return fail! unless user = account.users.find_by(email: params["user"]["email"])
		return fail! unless user.authenticate(params["user"]["password"])
		success! user
	end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mtwarden-3.3.4 config/initializers/warden/strategies/password.rb
mtwarden-3.3.3 config/initializers/warden/strategies/password.rb
mtwarden-3.3.2 config/initializers/warden/strategies/password.rb
mtwarden-3.3.1 config/initializers/warden/strategies/password.rb
mtwarden-3.3.0 config/initializers/warden/strategies/password.rb
mtwarden-3.2.0 config/initializers/warden/strategies/password.rb
mtwarden-3.1.2 config/initializers/warden/strategies/password.rb
mtwarden-3.1.1 config/initializers/warden/strategies/password.rb
mtwarden-3.1.0 config/initializers/warden/strategies/password.rb
mtwarden-3.0.3 config/initializers/warden/strategies/password.rb
mtwarden-3.0.2 config/initializers/warden/strategies/password.rb
mtwarden-3.0.1 config/initializers/warden/strategies/password.rb
mtwarden-2.2.7 config/initializers/warden/strategies/password.rb
mtwarden-2.2.6 config/initializers/warden/strategies/password.rb
mtwarden-2.2.5 config/initializers/warden/strategies/password.rb
mtwarden-2.2.0 config/initializers/warden/strategies/password.rb
mtwarden-2.1.0 config/initializers/warden/strategies/password.rb