1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-26 07:19:23 +00:00

Can get security settings

This commit is contained in:
Pierre HUBERT 2020-03-21 19:00:08 +01:00
parent 02ee59817a
commit 3811a26024
2 changed files with 21 additions and 0 deletions

View File

@ -91,6 +91,8 @@ export const Routes : Route[] = [
{path: "/settings/set_language", cb: (h) => SettingsController.SetLanguage(h)}, {path: "/settings/set_language", cb: (h) => SettingsController.SetLanguage(h)},
{path: "/settings/get_security", cb: (h) => SettingsController.GetSecurity(h)},
// Friends controller // Friends controller
{path: "/friends/getList", cb: (h) => FriendsController.GetList(h)}, {path: "/friends/getList", cb: (h) => FriendsController.GetList(h)},

View File

@ -135,4 +135,23 @@ export class SettingsController {
h.success(); h.success();
} }
/**
* Get security settings
*
* @param h Request handler
*/
public static async GetSecurity(h: RequestHandler) {
await h.needUserPostPassword("password");
const userInfo = await UserHelper.GetUserInfo(h.getUserId());
h.send({
id: userInfo.id,
security_question_1: userInfo.hasSecurityQuestion1 ? userInfo.security_question_1 : "",
security_answer_1: userInfo.hasSecurityAnswer1 ? userInfo.security_answer_1 : "",
security_question_2: userInfo.hasSecurityQuestion2 ? userInfo.security_question_2 : "",
security_answer_2: userInfo.hasSecurityAnswer2 ? userInfo.security_answer_2 : "",
});
}
} }