2
0
mirror of https://github.com/Ride-The-Lightning/RTL synced 2024-11-03 23:15:24 +00:00

Issue #143 Default auth bug fix

Issue #143 Default auth bug fix
This commit is contained in:
ShahanaFarooqui 2019-05-12 14:09:07 -04:00
parent 2035a71d05
commit e7515fe7c1
7 changed files with 48 additions and 25 deletions

View File

@ -8,5 +8,5 @@
<link rel="stylesheet" href="styles.4ea35a27750bb09e5436.css"></head>
<body>
<rtl-app></rtl-app>
<script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script><script type="text/javascript" src="polyfills.d68e8f4f73dfaef206f1.js"></script><script type="text/javascript" src="main.dd08f35ad522015a7bf3.js"></script></body>
<script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script><script type="text/javascript" src="polyfills.d68e8f4f73dfaef206f1.js"></script><script type="text/javascript" src="main.6a18826b4a451ccb5b3b.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,8 @@ var common = require('../common');
var connect = require('../connect');
const jwt = require("jsonwebtoken");
var upperCase = require('upper-case');
var atob = require('atob');
var crypto = require('crypto');
var hash = crypto.createHash('sha256');
var logger = require('./logger');
exports.authenticateUserWithCookie = (req, res, next) => {
@ -89,25 +90,25 @@ exports.authenticateUser = (req, res, next) => {
});
} else {
const jsonLNDConfig = ini.parse(data);
if ((undefined !== jsonLNDConfig.Bitcoind && undefined !== jsonLNDConfig.Bitcoind['bitcoind.rpcpass']) || (undefined !== jsonLNDConfig['bitcoind.rpcpass'])) {
if ((undefined !== jsonLNDConfig.Bitcoind && jsonLNDConfig.Bitcoind['bitcoind.rpcpass'] === password) || (undefined !== jsonLNDConfig['bitcoind.rpcpass'] && jsonLNDConfig['bitcoind.rpcpass'] === password)) {
var rpcUser = (undefined !== jsonLNDConfig.Bitcoind && undefined !== jsonLNDConfig.Bitcoind['bitcoind.rpcuser']) ? jsonLNDConfig.Bitcoind['bitcoind.rpcuser'] : '';
rpcUser = (rpcUser === '' && undefined !== jsonLNDConfig['bitcoind.rpcuser']) ? jsonLNDConfig['bitcoind.rpcuser'] : '';
const token = jwt.sign(
{ user: rpcUser, lndConfigPath: common.nodes[0].lnd_config_path, macaroonPath: common.nodes[0].macaroon_path },
common.secret_key
);
res.status(200).json({ token: token });
} else {
res.status(401).json({
message: "Authentication Failed!",
error: "Password Validation Failed!"
});
}
var rpcPass = '';
if (undefined !== jsonLNDConfig.Bitcoind && undefined !== jsonLNDConfig.Bitcoind['bitcoind.rpcpass']) {
rpcPass = jsonLNDConfig.Bitcoind['bitcoind.rpcpass'];
} else if (undefined !== jsonLNDConfig['bitcoind.rpcpass']) {
rpcPass = jsonLNDConfig['bitcoind.rpcpass'];
}
rpcPass = hash.update(rpcPass).digest('hex');
if (rpcPass === password) {
var rpcUser = (undefined !== jsonLNDConfig.Bitcoind && undefined !== jsonLNDConfig.Bitcoind['bitcoind.rpcuser']) ? jsonLNDConfig.Bitcoind['bitcoind.rpcuser'] : '';
rpcUser = (rpcUser === '' && undefined !== jsonLNDConfig['bitcoind.rpcuser']) ? jsonLNDConfig['bitcoind.rpcuser'] : '';
const token = jwt.sign(
{ user: rpcUser, lndConfigPath: common.nodes[0].lnd_config_path, macaroonPath: common.nodes[0].macaroon_path },
common.secret_key
);
res.status(200).json({ token: token });
} else {
res.status(401).json({
message: "Authentication Failed!",
error: "Password Not Found In LND Config!"
error: "Password Validation Failed!"
});
}
}

View File

@ -1,6 +1,6 @@
<div fxLayout="column">
<div class="padding-gap">
<mat-card>
<mat-card [ngClass]="{'flip': redirectedWithPeer}">
<mat-card-header>
<mat-card-subtitle>
<h2>Add Channel</h2>

View File

@ -43,4 +43,25 @@ table {
.chkbox-options:focus {
outline: none !important;
}
}
.flip {
position: relative;
backface-visibility: hidden;
animation: spin 1.5s cubic-bezier(.175, .885, .32, 1.275) 1;
transform-style: preserve-3d;
transform: rotateX(0deg);
}
@-moz-keyframes spin {
from { -moz-transform: rotateX(0deg); }
to { -moz-transform: rotateX(360deg); }
}
@-webkit-keyframes spin {
from { -webkit-transform: rotateX(0deg); }
to { -webkit-transform: rotateX(360deg); }
}
@keyframes spin {
from { transform:rotateX(0deg); }
to { transform:rotateX(360deg); }
}

View File

@ -40,11 +40,10 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
public isPrivate = false;
public moreOptions = false;
public flgSticky = false;
private state$: Observable<object>;
public redirectedWithPeer = false;
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects, private actions$: Actions,
private router: Router, private activatedRoute: ActivatedRoute) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects, private activatedRoute: ActivatedRoute) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['close', 'update', 'active', 'chan_id', 'remote_alias'];
@ -97,6 +96,7 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
});
this.activatedRoute.paramMap.subscribe(() => {
this.selectedPeer = window.history.state.peer;
this.redirectedWithPeer = (window.history.state.peer) ? true : false;
});
}
@ -242,6 +242,7 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
this.isPrivate = false;
this.selTransType = '0';
this.transTypeValue = {blocks: '', fees: ''};
this.redirectedWithPeer = false;
}
onMoreOptionsChange(event: any) {

View File

@ -1 +1 @@
export const VERSION = '0.3.1-beta';
export const VERSION = '0.3.2-beta';