logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

authenticator.ex (580B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 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