Adding new API for getting contact information of user

This commit is contained in:
Fabian Stamm
2020-03-11 16:59:13 +01:00
parent c8550b517a
commit 92cc97c396
11 changed files with 161 additions and 93 deletions

View File

@ -11,10 +11,23 @@ import TwoFactor from "./models/twofactor";
import * as speakeasy from "speakeasy";
import LoginToken from "./models/login_token";
import { log } from "handlebars";
import Mail from "./models/mail";
export default async function TestData() {
await DB.db.dropDatabase();
let mail = await Mail.findOne({ mail: "test@test.de" });
if (!mail) {
mail = Mail.new({
mail: "test@test.de",
primary: true,
verified: true
})
await Mail.save(mail);
}
let u = await User.findOne({ username: "test" });
if (!u) {
Logging.log("Adding test user");
@ -25,7 +38,12 @@ export default async function TestData() {
name: "Test Test",
password: "125d6d03b32c84d492747f79cf0bf6e179d287f341384eb5d6d3197525ad6be8e6df0116032935698f99a09e265073d1d6c32c274591bf1d0a20ad67cba921bc",
salt: "test",
admin: true
admin: true,
phones: [
{ phone: "+4915962855955", primary: true, verified: true },
{ phone: "+4915962855932", primary: false, verified: false }
],
mails: [mail._id]
})
await User.save(u);
}