forked from cory/tildefriends
Revert "build: Add prettier to the project"
This reverts commit 41024ddb79
.
This commit is contained in:
parent
e361c3f975
commit
7822b30dcb
31
core/auth.js
31
core/auth.js
@ -54,30 +54,8 @@ function makeJwt(payload) {
|
|||||||
id = ssb.createIdentity(':auth');
|
id = ssb.createIdentity(':auth');
|
||||||
}
|
}
|
||||||
|
|
||||||
const final_payload = b64url(
|
let final_payload = b64url(base64Encode(JSON.stringify(Object.assign({}, payload, {exp: (new Date().valueOf()) + kRefreshInterval}))));
|
||||||
base64Encode(
|
let jwt = [b64url(base64Encode(JSON.stringify({alg: 'HS256', typ: 'JWT'}))), final_payload, b64url(ssb.hmacsha256sign(final_payload, ':auth', id))].join('.');
|
||||||
JSON.stringify(
|
|
||||||
Object.assign({}, payload, {exp: (new Date().valueOf()) + kRefreshInterval}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
const jwt = [
|
|
||||||
b64url(
|
|
||||||
base64Encode(
|
|
||||||
JSON.stringify({
|
|
||||||
alg: 'HS256',
|
|
||||||
typ: 'JWT'
|
|
||||||
})
|
|
||||||
)
|
|
||||||
),
|
|
||||||
final_payload,
|
|
||||||
b64url(
|
|
||||||
ssb.hmacsha256sign(final_payload, ':auth', id)
|
|
||||||
)
|
|
||||||
].join('.');
|
|
||||||
|
|
||||||
return jwt;
|
return jwt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,9 +119,7 @@ function hashPassword(password) {
|
|||||||
* @returns TODOC
|
* @returns TODOC
|
||||||
*/
|
*/
|
||||||
function noAdministrator() {
|
function noAdministrator() {
|
||||||
return !core.globalSettings ||
|
return !core.globalSettings || !core.globalSettings.permissions || !Object.keys(core.globalSettings.permissions).some(function(name) {
|
||||||
!core.globalSettings.permissions ||
|
|
||||||
!Object.keys(core.globalSettings.permissions).some(function(name) {
|
|
||||||
return core.globalSettings.permissions[name].indexOf("administration") != -1;
|
return core.globalSettings.permissions[name].indexOf("administration") != -1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -207,7 +183,6 @@ function isNameValid(name) {
|
|||||||
function handler(request, response) {
|
function handler(request, response) {
|
||||||
// TODO(tasiaiso): split this function
|
// TODO(tasiaiso): split this function
|
||||||
let session = getCookies(request.headers).session;
|
let session = getCookies(request.headers).session;
|
||||||
|
|
||||||
if (request.uri == "/login") {
|
if (request.uri == "/login") {
|
||||||
let formData = form.decodeForm(request.query);
|
let formData = form.decodeForm(request.query);
|
||||||
if (query(request.headers)?.permissions?.authenticated) {
|
if (query(request.headers)?.permissions?.authenticated) {
|
||||||
|
Loading…
Reference in New Issue
Block a user