Compare commits
	
		
			4 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4ffc06db7b | |||
| 
						
						
							
						
						588f3bae89
	
				 | 
					
					
						|||
| d889432ce8 | |||
| 
						
						
							
						
						44830f08bc
	
				 | 
					
					
						
							
								
								
									
										14
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -2,12 +2,26 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
 | 
					All notable changes to this project will be documented in this file. Dates are displayed in UTC.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### [0.4.2](https://git.odit.services/kauft.es/linkylinky/compare/0.4.1...0.4.2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Changed register api route and added user deletion route [`588f3ba`](https://git.odit.services/kauft.es/linkylinky/commit/588f3bae8980f76461d20e15475ec797078b0b54)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### [0.4.1](https://git.odit.services/kauft.es/linkylinky/compare/0.4.0...0.4.1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 18 August 2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- 🚀RELEASE 0.4.1 [`d889432`](https://git.odit.services/kauft.es/linkylinky/commit/d889432ce8a403f6a609423eaf458a5904dc5b98)
 | 
				
			||||||
 | 
					- Fixed jwtcount not being recognized [`44830f0`](https://git.odit.services/kauft.es/linkylinky/commit/44830f08bc212f8079b5ac2da3d51eedbe6d5c41)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### [0.4.0](https://git.odit.services/kauft.es/linkylinky/compare/0.3.0...0.4.0)
 | 
					#### [0.4.0](https://git.odit.services/kauft.es/linkylinky/compare/0.3.0...0.4.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 18 August 2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Basic jwt implementation :party: [`75473ca`](https://git.odit.services/kauft.es/linkylinky/commit/75473cabe79975296e473002e16d3abafbd2635e)
 | 
					- Basic jwt implementation :party: [`75473ca`](https://git.odit.services/kauft.es/linkylinky/commit/75473cabe79975296e473002e16d3abafbd2635e)
 | 
				
			||||||
- Implemented jwtcount basics [`48cc380`](https://git.odit.services/kauft.es/linkylinky/commit/48cc380504206ea08b3a5082f19ad10bdd7cf773)
 | 
					- Implemented jwtcount basics [`48cc380`](https://git.odit.services/kauft.es/linkylinky/commit/48cc380504206ea08b3a5082f19ad10bdd7cf773)
 | 
				
			||||||
- Implemented jwt count validation and update on logout [`558b69e`](https://git.odit.services/kauft.es/linkylinky/commit/558b69eeaa78ea015473c674d5f919d64128a930)
 | 
					- Implemented jwt count validation and update on logout [`558b69e`](https://git.odit.services/kauft.es/linkylinky/commit/558b69eeaa78ea015473c674d5f919d64128a930)
 | 
				
			||||||
- Switched to fastify-auth to support multiple auth providers [`6420ffb`](https://git.odit.services/kauft.es/linkylinky/commit/6420ffb055f08348c54cd08a193aba5fe5ebc13a)
 | 
					- Switched to fastify-auth to support multiple auth providers [`6420ffb`](https://git.odit.services/kauft.es/linkylinky/commit/6420ffb055f08348c54cd08a193aba5fe5ebc13a)
 | 
				
			||||||
 | 
					- 🚀RELEASE 0.4.0 [`1cd3ebf`](https://git.odit.services/kauft.es/linkylinky/commit/1cd3ebf8c5a9413b93ab49c8813dad5c5c547cb2)
 | 
				
			||||||
- All authenticated entpoints now accept jwtauth [`2b22063`](https://git.odit.services/kauft.es/linkylinky/commit/2b22063a81193c3d698525a050ef300e542c1f05)
 | 
					- All authenticated entpoints now accept jwtauth [`2b22063`](https://git.odit.services/kauft.es/linkylinky/commit/2b22063a81193c3d698525a050ef300e542c1f05)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### [0.3.0](https://git.odit.services/kauft.es/linkylinky/compare/0.2.0...0.3.0)
 | 
					#### [0.3.0](https://git.odit.services/kauft.es/linkylinky/compare/0.2.0...0.3.0)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "@odit/shortener-backend",
 | 
					  "name": "@odit/shortener-backend",
 | 
				
			||||||
  "version": "0.4.0",
 | 
					  "version": "0.4.2",
 | 
				
			||||||
  "main": "index.js",
 | 
					  "main": "index.js",
 | 
				
			||||||
  "license": "MIT",
 | 
					  "license": "MIT",
 | 
				
			||||||
  "private": false,
 | 
					  "private": false,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,7 +56,7 @@ fastify.decorate('verifyJWT', function async(request, reply, done) {
 | 
				
			|||||||
            .where('username', '=', decoded.payload.user)
 | 
					            .where('username', '=', decoded.payload.user)
 | 
				
			||||||
            .limit(1))[0].jwtcount;
 | 
					            .limit(1))[0].jwtcount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (decoded.payload.jwtcount < jwtcount || !decoded.payload.jwtcount) {
 | 
					        if (decoded.payload.jwtcount < jwtcount) {
 | 
				
			||||||
            fastify.log.error("Auth ended at jwtcount")
 | 
					            fastify.log.error("Auth ended at jwtcount")
 | 
				
			||||||
            done(new Error("JWT in no longer valid"))
 | 
					            done(new Error("JWT in no longer valid"))
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -223,7 +223,7 @@ fastify.get('/api/:shortcode', async (req, res) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//User registration
 | 
					//User registration
 | 
				
			||||||
fastify.post('/api/register', async (req, res) => {
 | 
					fastify.post('/api/auth/register', async (req, res) => {
 | 
				
			||||||
    if (!config.registrationEnabled) {
 | 
					    if (!config.registrationEnabled) {
 | 
				
			||||||
        res.statusCode = 400;
 | 
					        res.statusCode = 400;
 | 
				
			||||||
        return "Registration was disabled by your admin";
 | 
					        return "Registration was disabled by your admin";
 | 
				
			||||||
@@ -347,6 +347,14 @@ fastify.after(() => {
 | 
				
			|||||||
        return "Done!";
 | 
					        return "Done!";
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fastify.post('/api/auth/deleteme', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, reply) => {
 | 
				
			||||||
 | 
					        await knex('users')
 | 
				
			||||||
 | 
					            .where('username', '=', req.user)
 | 
				
			||||||
 | 
					            .delete();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return "Done!";
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user