1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 00:05:16 +00:00

Show security questions

This commit is contained in:
2020-05-03 15:35:07 +02:00
parent 91e7dd4019
commit e78d526bbb
2 changed files with 87 additions and 6 deletions

View File

@ -130,10 +130,20 @@ class AccountHelper {
/// Throws in case of failure
static Future<bool> hasSecurityQuestions(String email) async =>
(await APIRequest.withoutLogin("account/has_security_questions")
.addString("email", email)
.execWithThrow())
.addString("email", email)
.execWithThrow())
.getObject()["defined"];
/// Get the security questions of the user
///
/// Throws in case of failure
static Future<List<String>> getSecurityQuestions(String email) async =>
((await APIRequest.withoutLogin("account/get_security_questions")
.addString("email", email)
.execWithThrow())
.getObject()["questions"])
.cast<String>();
/// Get current user ID from the server
Future<int> _downloadCurrentUserID() async {
final response = await APIRequest(