mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
28 lines
414 B
JavaScript
Executable file
28 lines
414 B
JavaScript
Executable file
const jwt = require('jsonwebtoken');
|
|
|
|
module.exports = {
|
|
sync: true,
|
|
|
|
inputs: {
|
|
token: {
|
|
type: 'string',
|
|
required: true,
|
|
},
|
|
},
|
|
|
|
exits: {
|
|
invalidToken: {},
|
|
},
|
|
|
|
fn(inputs, exits) {
|
|
let payload;
|
|
|
|
try {
|
|
payload = jwt.verify(inputs.token, sails.config.session.secret);
|
|
} catch (error) {
|
|
throw 'invalidToken';
|
|
}
|
|
|
|
return exits.success(payload);
|
|
},
|
|
};
|