1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 08:35:17 +00:00

Can get the ID of a user from its email address

This commit is contained in:
2019-12-28 17:20:27 +01:00
parent fb96a76e4e
commit 5b6ad59486
2 changed files with 33 additions and 0 deletions

View File

@ -175,6 +175,24 @@ export class AccountHelper {
}) > 0;
}
/**
* Find user ID from its email address
*
* @param email Email address
* @returns The ID of the matching user / -1 if none found
*/
public static async FindIDFromEmail(email: string) : Promise<number> {
const result = await DatabaseHelper.QueryRow({
table: USER_TABLE,
where: {
mail: email,
},
fields: ["ID"]
});
return result == null ? -1 : result.ID;
}
/**
* Check out whether a virtual directory is available or not