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

Can check out wheter user has setup security questions or not

This commit is contained in:
2019-12-29 19:40:35 +01:00
parent 5b6ad59486
commit 4297cabd7e
4 changed files with 71 additions and 6 deletions

View File

@ -1,5 +1,6 @@
import { RequestHandler } from "../entities/RequestHandler";
import { AccountHelper } from "../helpers/AccountHelper";
import { UserHelper } from "../helpers/UserHelper";
/**
* Account controller
@ -78,4 +79,19 @@ export class AccountController {
exists: await AccountHelper.ExistsEmail(email)
})
}
/**
* Check if an account associated with an email address has
* setup security questions or not
*
* @param h Request handler
*/
public static async HasSecurityQuestions(h: RequestHandler) {
const userID = await h.postUserIdFromEmail("email");
const settings = await UserHelper.GetUserInfo(userID);
h.send({
defined: settings.hasSecurityQuestions
})
}
}

View File

@ -45,6 +45,8 @@ export const Routes : Route[] = [
{path: "/account/exists_email", cb: (h) => AccountController.ExistsMail(h), needLogin: false},
{path: "/account/has_security_questions", cb: (h) => AccountController.HasSecurityQuestions(h), needLogin: false},
// User controller
{path: "/user/getInfo", cb: (h) => UserController.GetSingle(h), needLogin: false},