mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-04 03:24:04 +00:00 
			
		
		
		
	Can get security settings
This commit is contained in:
		@@ -91,6 +91,8 @@ export const Routes : Route[] = [
 | 
			
		||||
 | 
			
		||||
	{path: "/settings/set_language", cb: (h) => SettingsController.SetLanguage(h)},
 | 
			
		||||
 | 
			
		||||
	{path: "/settings/get_security", cb: (h) => SettingsController.GetSecurity(h)},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// Friends controller
 | 
			
		||||
	{path: "/friends/getList", cb: (h) => FriendsController.GetList(h)},
 | 
			
		||||
 
 | 
			
		||||
@@ -135,4 +135,23 @@ export class SettingsController {
 | 
			
		||||
 | 
			
		||||
		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 : "",
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user