mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2026-08-13 12:33:07 +02:00
Issue 181 refresh page
Issue 181 refresh page
This commit is contained in:
parent
4a4677781f
commit
c641c1e1dd
9 changed files with 22 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -44,3 +44,4 @@ RTL-Multi-Node-Conf.json
|
|||
RTL-Multi-Node-Conf-1.json
|
||||
/backup/*
|
||||
cookies
|
||||
sample-RTL-SSO.conf
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
<link rel="stylesheet" href="styles.57e2ca8febc1e490a78e.css"></head>
|
||||
<body>
|
||||
<rtl-app></rtl-app>
|
||||
<script src="runtime.f8adc32abf38a237412d.js"></script><script src="polyfills-es5.763f4f23e8aee5ec234d.js" nomodule></script><script src="polyfills.e59b6f9dc696bd89cf7f.js"></script><script src="main.767ec8216032d4e65e79.js"></script></body>
|
||||
<script src="runtime.f8adc32abf38a237412d.js"></script><script src="polyfills-es5.763f4f23e8aee5ec234d.js" nomodule></script><script src="polyfills.e59b6f9dc696bd89cf7f.js"></script><script src="main.320310cf17286025611f.js"></script></body>
|
||||
</html>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,12 +7,15 @@ var upperCase = require('upper-case');
|
|||
var crypto = require('crypto');
|
||||
var hash = crypto.createHash('sha256');
|
||||
var logger = require('./logger');
|
||||
var token = '';
|
||||
|
||||
exports.authenticateUser = (req, res, next) => {
|
||||
if(+common.rtl_sso) {
|
||||
if (crypto.createHash('sha256').update(common.cookie).digest('hex') === req.body.password) {
|
||||
if(req.body.authenticateWith === 'TOKEN' && jwt.verify(req.body.authenticationValue, common.secret_key)) {
|
||||
res.status(200).json({ token: token });
|
||||
} else if (req.body.authenticateWith === 'PASSWORD' && crypto.createHash('sha256').update(common.cookie).digest('hex') === req.body.authenticationValue) {
|
||||
connect.refreshCookie(common.rtl_cookie_path);
|
||||
const token = jwt.sign(
|
||||
token = jwt.sign(
|
||||
{ user: 'Custom_User', configPath: common.nodes[0].config_path, macaroonPath: common.nodes[0].macaroon_path },
|
||||
common.secret_key
|
||||
);
|
||||
|
|
@ -25,7 +28,7 @@ exports.authenticateUser = (req, res, next) => {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
const password = req.body.password;
|
||||
const password = req.body.authenticationValue;
|
||||
if (common.multi_node_setup) {
|
||||
if (common.rtl_pass === password) {
|
||||
var rpcUser = 'Multi_Node_User';
|
||||
|
|
|
|||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "rtl",
|
||||
"version": "0.5.0-beta",
|
||||
"version": "0.5.1-beta",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "rtl",
|
||||
"version": "0.5.0-beta",
|
||||
"version": "0.5.1-beta",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
|
||||
private readAccessKey() {
|
||||
const url = window.location.href;
|
||||
return url.substring(url.lastIndexOf('access-key=') + 11).trim();
|
||||
return url.includes('access-key=') ? url.substring(url.lastIndexOf('access-key=') + 11).trim() : '';
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
import { GetInfoChain } from './lndModels';
|
||||
|
||||
export enum AuthenticateWith {
|
||||
TOKEN = 'TOKEN',
|
||||
PASSWORD = 'PASSWORD'
|
||||
}
|
||||
|
||||
export class SSO {
|
||||
constructor(
|
||||
public rtlSSO: number,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { MatDialog } from '@angular/material';
|
|||
|
||||
import { environment, API_URL } from '../../environments/environment';
|
||||
import { LoggerService } from '../shared/services/logger.service';
|
||||
import { Settings, RTLConfiguration } from '../shared/models/RTLconfig';
|
||||
import { Settings, RTLConfiguration, AuthenticateWith } from '../shared/models/RTLconfig';
|
||||
|
||||
import { SpinnerDialogComponent } from '../shared/components/spinner-dialog/spinner-dialog.component';
|
||||
import { AlertMessageComponent } from '../shared/components/alert-message/alert-message.component';
|
||||
|
|
@ -95,7 +95,6 @@ export class RTLEffects implements OnDestroy {
|
|||
}),
|
||||
map((rtlConfig: RTLConfiguration) => {
|
||||
this.logger.info(rtlConfig);
|
||||
if (+rtlConfig.sso.rtlSSO) { this.store.dispatch(new RTLActions.Signout()); }
|
||||
this.store.dispatch(new RTLActions.SetSelelectedNode({lnNode: rtlConfig.nodes.find(node => +node.index === rtlConfig.selectedNodeIndex), isInitialSetup: true}))
|
||||
return {
|
||||
type: RTLActions.SET_RTL_CONFIG,
|
||||
|
|
@ -198,7 +197,10 @@ export class RTLEffects implements OnDestroy {
|
|||
withLatestFrom(this.store.select('root')),
|
||||
mergeMap(([action, rootStore]: [RTLActions.Signin, fromRTLReducer.RootState]) => {
|
||||
this.store.dispatch(new RTLActions.ClearEffectErrorRoot('Signin'));
|
||||
return this.httpClient.post(environment.AUTHENTICATE_API, { password: action.payload })
|
||||
return this.httpClient.post(environment.AUTHENTICATE_API, {
|
||||
authenticateWith: (undefined === action.payload || action.payload == null || action.payload === '') ? AuthenticateWith.TOKEN : AuthenticateWith.PASSWORD,
|
||||
authenticationValue: (undefined === action.payload || action.payload == null || action.payload === '') ? (sessionStorage.getItem('token') ? sessionStorage.getItem('token') : '') : action.payload
|
||||
})
|
||||
.pipe(
|
||||
map((postRes: any) => {
|
||||
this.logger.info(postRes);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue