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:
@ -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
|
||||
})
|
||||
}
|
||||
}
|
@ -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},
|
||||
|
Reference in New Issue
Block a user