修改了auth的bug
This commit is contained in:
		
							parent
							
								
									af71c348f4
								
							
						
					
					
						commit
						8d221222a9
					
				@ -69,7 +69,7 @@ AuthToken.prototype.getTokenData = async function (userToken) {
 | 
			
		||||
  return tokenData;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
AuthToken.prototype.checkTokenKoaRequest = async function (ctx, userkey, checkKey, next) {
 | 
			
		||||
AuthToken.prototype.checkTokenKoaRequest = async function (ctx, next) {
 | 
			
		||||
  let token = ctx.request.body.token
 | 
			
		||||
  if (!token) token = ctx.header['authorization']
 | 
			
		||||
  if (!token) token = token = ctx.header['token']
 | 
			
		||||
@ -81,7 +81,7 @@ AuthToken.prototype.checkTokenKoaRequest = async function (ctx, userkey, checkKe
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  let tokenData = await this.checkToken(token, userkey, checkKey);
 | 
			
		||||
  let tokenData = await this.checkToken(token, "");
 | 
			
		||||
  if (!ret) {
 | 
			
		||||
    ctx.body = {
 | 
			
		||||
      result: 'fail', error: { code: 401, msg: 'User token error.' }, data: {}
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@ehason/auth",
 | 
			
		||||
  "version": "1.3.0",
 | 
			
		||||
  "version": "1.3.1",
 | 
			
		||||
  "description": "User auth lib",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user