Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
580B

  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.BBS.Authenticator do
  5. use Sshd.PasswordAuthenticator
  6. alias Pleroma.User
  7. alias Pleroma.Web.Plugs.AuthenticationPlug
  8. def authenticate(username, password) do
  9. username = to_string(username)
  10. password = to_string(password)
  11. with %User{} = user <- User.get_by_nickname(username) do
  12. AuthenticationPlug.checkpw(password, user.password_hash)
  13. else
  14. _e -> false
  15. end
  16. end
  17. end