Upgrade Comeonin to v5
[akkoma] / lib / pleroma / bbs / authenticator.ex
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
5 defmodule Pleroma.BBS.Authenticator do
6 use Sshd.PasswordAuthenticator
7 alias Pleroma.User
8
9 def authenticate(username, password) do
10 username = to_string(username)
11 password = to_string(password)
12
13 with %User{} = user <- User.get_by_nickname(username) do
14 Pbkdf2.verify_pass(password, user.password_hash)
15 else
16 _e -> false
17 end
18 end
19 end