mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2025-02-22 14:22:48 +01:00
Revert "Issue #58 Redirect to root after authentication"
This reverts commit f229f047a7
.
This commit is contained in:
parent
f229f047a7
commit
c5017cf0be
8 changed files with 10 additions and 23 deletions
|
@ -8,5 +8,5 @@
|
|||
<link rel="stylesheet" href="styles.7e944f30e4357f41ed14.css"></head>
|
||||
<body>
|
||||
<rtl-app></rtl-app>
|
||||
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.418928a701f2040ada02.js"></script><script type="text/javascript" src="main.245bfa4bc1c665f13866.js"></script></body>
|
||||
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.418928a701f2040ada02.js"></script><script type="text/javascript" src="main.e11044a8702e0e3c2456.js"></script></body>
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
8
app.js
8
app.js
|
@ -21,14 +21,10 @@ const invoiceRoutes = require("./routes/invoices");
|
|||
const switchRoutes = require("./routes/switch");
|
||||
const baseHref = '/rtl/';
|
||||
const apiRoot = baseHref + 'api/';
|
||||
var options = {
|
||||
setHeaders: function (res, path, stat) {
|
||||
res.status(301)
|
||||
}
|
||||
}
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(baseHref, express.static(path.join(__dirname, "angular"), options));
|
||||
app.use(baseHref, express.static(path.join(__dirname, "angular")));
|
||||
|
||||
// CORS fix, Only required for developement due to separate backend and frontend servers
|
||||
app.use((req, res, next) => {
|
||||
|
|
|
@ -14,7 +14,6 @@ common.rtl_sso = 0;
|
|||
common.rtl_cookie_path = '';
|
||||
common.logout_redirect_link = '/login';
|
||||
common.cookie = '';
|
||||
common.password = '';
|
||||
|
||||
common.convertToBTC = (num) => {
|
||||
return (num / 100000000).toFixed(6);
|
||||
|
|
|
@ -6,21 +6,15 @@ var upperCase = require('upper-case');
|
|||
var atob = require('atob');
|
||||
var logger = require('./logger');
|
||||
|
||||
exports.redirectUser = (req, res, next) => {
|
||||
common.password = req.params.pwd;
|
||||
res.redirect(301, '/rtl/');
|
||||
}
|
||||
|
||||
exports.authenticateUser = (req, res, next) => {
|
||||
password = atob(req.body.password);
|
||||
if(+common.rtl_sso) {
|
||||
password = common.password;
|
||||
common.password = '';
|
||||
if (common.cookie === password) {
|
||||
const token = jwt.sign(
|
||||
{ user: 'Custom_User', lndConfigPath: common.lnd_config_path, macaroonPath: common.macaroon_path },
|
||||
'default_secret_key'
|
||||
);
|
||||
res.status(200).json({token: token});
|
||||
res.status(200).json({ token: token });
|
||||
} else {
|
||||
res.status(401).json({
|
||||
message: "Login Failure!",
|
||||
|
@ -28,7 +22,6 @@ exports.authenticateUser = (req, res, next) => {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
password = atob(req.body.password);
|
||||
if(upperCase(common.node_auth_type) === 'CUSTOM') {
|
||||
if (common.rtl_pass === password) {
|
||||
var rpcUser = 'Custom_User';
|
||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "rtl",
|
||||
"version": "0.2.9-beta",
|
||||
"version": "0.2.8-beta",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "rtl",
|
||||
"version": "0.2.9-beta",
|
||||
"version": "0.2.8-beta",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"serve": "ng build --prod --base-href /rtl/ && ng serve",
|
||||
"start": "ng build --prod && ng serve",
|
||||
"serve": "ng serve",
|
||||
"prebuild": "node ./prebuild",
|
||||
"build": "ng build --prod --base-href /rtl/",
|
||||
"test": "ng test",
|
||||
|
|
|
@ -2,7 +2,6 @@ const AuthenticateController = require("../controllers/authenticate");
|
|||
const express = require("express");
|
||||
const router = express.Router();
|
||||
|
||||
router.get("/:pwd", AuthenticateController.redirectUser);
|
||||
router.post("/", AuthenticateController.authenticateUser);
|
||||
|
||||
module.exports = router;
|
||||
|
|
Loading…
Add table
Reference in a new issue