add support to loginparams for handling a prehashed password
This commit is contained in:
committed by
Casper Warden
parent
618cfe716f
commit
971e57a097
@@ -1,6 +1,5 @@
|
||||
import validator from 'validator';
|
||||
import * as xmlrpc from 'xmlrpc';
|
||||
import * as crypto from 'crypto';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { LoginError } from './classes/LoginError';
|
||||
@@ -87,7 +86,7 @@ export class LoginHandler
|
||||
{
|
||||
'first': params.firstName,
|
||||
'last': params.lastName,
|
||||
'passwd': '$1$' + crypto.createHash('md5').update(params.password.substr(0, 16)).digest('hex'),
|
||||
'passwd': params.getHashedPassword(),
|
||||
'start': params.start,
|
||||
'major': '0',
|
||||
'minor': '0',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
export class LoginParameters
|
||||
{
|
||||
firstName: string;
|
||||
@@ -9,4 +11,15 @@ export class LoginParameters
|
||||
mfa_hash?: string;
|
||||
agreeToTOS?: true;
|
||||
readCritical?: true;
|
||||
|
||||
passwordPrehashed = false;
|
||||
|
||||
getHashedPassword(): string
|
||||
{
|
||||
if (this.passwordPrehashed)
|
||||
{
|
||||
return this.password;
|
||||
}
|
||||
return '$1$' + crypto.createHash('md5').update(this.password.substr(0, 16)).digest('hex');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user