1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 08:55:16 +00:00

Can check if an email address exists or not

This commit is contained in:
2020-07-13 13:00:02 +02:00
parent c2c6a24b29
commit 071c773412
5 changed files with 35 additions and 1 deletions

View File

@ -77,6 +77,14 @@ pub fn get_user_by_login_token(token: &str, client: &APIClient) -> ResultBoxErro
)
}
/// Check out whether an email address exists or not
pub fn exists_mail(mail: &str) -> ResultBoxError<bool> {
database::QueryInfo::new(USERS_TABLE)
.cond("mail", mail)
.exec_count()
.map(|r| r > 0)
}
/// Destroy a given user login tokens
pub fn destroy_login_tokens(id: &UserID, client: &APIClient) -> ResultBoxError<()> {
database::delete(DeleteQuery::new(USER_ACCESS_TOKENS_TABLE)