Sha256: a4c2f22264788e9059655839364b9d043d79383cfaae4ced0eb3ce6120754641

Contents?: true

Size: 474 Bytes

Versions: 26

Compression:

Stored size: 474 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

26 entries across 26 versions & 1 rubygems

Version Path
mtwarden-17.1.0 config/initializers/warden/strategies/password.rb
mtwarden-17.0.0 config/initializers/warden/strategies/password.rb
mtwarden-16.2.0 config/initializers/warden/strategies/password.rb
mtwarden-16.1.0 config/initializers/warden/strategies/password.rb
mtwarden-16.0.0 config/initializers/warden/strategies/password.rb
mtwarden-15.0.0 config/initializers/warden/strategies/password.rb
mtwarden-14.0.0 config/initializers/warden/strategies/password.rb
mtwarden-13.0.1 config/initializers/warden/strategies/password.rb
mtwarden-13.0.0 config/initializers/warden/strategies/password.rb
mtwarden-12.0.0 config/initializers/warden/strategies/password.rb
mtwarden-11.0.0 config/initializers/warden/strategies/password.rb
mtwarden-9.0.0 config/initializers/warden/strategies/password.rb
mtwarden-8.1.0 config/initializers/warden/strategies/password.rb
mtwarden-8.0.1 config/initializers/warden/strategies/password.rb
mtwarden-8.0.0 config/initializers/warden/strategies/password.rb
mtwarden-7.2.0 config/initializers/warden/strategies/password.rb
mtwarden-7.1.2 config/initializers/warden/strategies/password.rb
mtwarden-7.1.1 config/initializers/warden/strategies/password.rb
mtwarden-7.1.0 config/initializers/warden/strategies/password.rb
mtwarden-7.0.0 config/initializers/warden/strategies/password.rb