Some bug fixes
This commit is contained in:
@ -37,7 +37,7 @@ export default async (req: express.Request, res: express.Response) => {
|
||||
}, {
|
||||
fields: {
|
||||
data: false,
|
||||
'account.profile': false
|
||||
'profile': false
|
||||
}
|
||||
}) as ILocalUser;
|
||||
|
||||
@ -48,15 +48,13 @@ export default async (req: express.Request, res: express.Response) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const account = user.account;
|
||||
|
||||
// Compare password
|
||||
const same = await bcrypt.compare(password, account.password);
|
||||
const same = await bcrypt.compare(password, password);
|
||||
|
||||
if (same) {
|
||||
if (account.twoFactorEnabled) {
|
||||
if (user.twoFactorEnabled) {
|
||||
const verified = (speakeasy as any).totp.verify({
|
||||
secret: account.twoFactorSecret,
|
||||
secret: user.twoFactorSecret,
|
||||
encoding: 'base32',
|
||||
token: token
|
||||
});
|
||||
|
@ -119,44 +119,29 @@ export default async (req: express.Request, res: express.Response) => {
|
||||
usernameLower: username.toLowerCase(),
|
||||
host: null,
|
||||
hostLower: null,
|
||||
account: {
|
||||
keypair: generateKeypair(),
|
||||
token: secret,
|
||||
email: null,
|
||||
links: null,
|
||||
password: hash,
|
||||
profile: {
|
||||
bio: null,
|
||||
birthday: null,
|
||||
blood: null,
|
||||
gender: null,
|
||||
handedness: null,
|
||||
height: null,
|
||||
location: null,
|
||||
weight: null
|
||||
},
|
||||
settings: {
|
||||
autoWatch: true
|
||||
},
|
||||
clientSettings: {
|
||||
home: homeData
|
||||
}
|
||||
keypair: generateKeypair(),
|
||||
token: secret,
|
||||
email: null,
|
||||
links: null,
|
||||
password: hash,
|
||||
profile: {
|
||||
bio: null,
|
||||
birthday: null,
|
||||
blood: null,
|
||||
gender: null,
|
||||
handedness: null,
|
||||
height: null,
|
||||
location: null,
|
||||
weight: null
|
||||
},
|
||||
settings: {
|
||||
autoWatch: true
|
||||
},
|
||||
clientSettings: {
|
||||
home: homeData
|
||||
}
|
||||
});
|
||||
|
||||
// Response
|
||||
res.send(await pack(account));
|
||||
|
||||
// Create search index
|
||||
if (config.elasticsearch.enable) {
|
||||
const es = require('../../db/elasticsearch');
|
||||
es.index({
|
||||
index: 'misskey',
|
||||
type: 'user',
|
||||
id: account._id.toString(),
|
||||
body: {
|
||||
username: username
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user