Сделано подтверждение регистрации пользователей #22
This commit is contained in:
@@ -35,11 +35,15 @@ authenticate_user(Email, Password) ->
|
||||
{ok, User} ->
|
||||
case verify_password(Password, User#user.password_hash) of
|
||||
{ok, true} ->
|
||||
{ok, #{
|
||||
id => User#user.id,
|
||||
email => User#user.email,
|
||||
role => atom_to_binary(User#user.role, utf8)
|
||||
}};
|
||||
case User#user.status of
|
||||
pending -> {error, not_verified};
|
||||
active -> {ok, #{
|
||||
id => User#user.id,
|
||||
email => User#user.email,
|
||||
role => atom_to_binary(User#user.role, utf8)
|
||||
}};
|
||||
_ -> {error, invalid_credentials}
|
||||
end;
|
||||
_ -> {error, invalid_credentials}
|
||||
end;
|
||||
{error, not_found} -> {error, invalid_credentials}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-module(logic_email).
|
||||
-export([send_verification_email/2]).
|
||||
send_verification_email(Email, Token) ->
|
||||
io:format("Sending verification email to ~s with token ~s~n", [Email, Token]).
|
||||
Reference in New Issue
Block a user