@adonisjs/auth
Advanced tools
Comparing version 4.1.4 to 4.1.5
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Auth = void 0; | ||
/** | ||
@@ -13,0 +14,0 @@ * Auth class exposes the API to obtain guard instances for a given |
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AuthManager = void 0; | ||
const utils_1 = require("@poppinss/utils"); | ||
@@ -13,0 +14,0 @@ const Auth_1 = require("../Auth"); |
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AuthenticationException = void 0; | ||
const utils_1 = require("@poppinss/utils"); | ||
@@ -13,0 +14,0 @@ /** |
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InvalidCredentialsException = void 0; | ||
const utils_1 = require("@poppinss/utils"); | ||
@@ -13,0 +14,0 @@ /** |
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SessionGuard = void 0; | ||
const utils_1 = require("@poppinss/utils"); | ||
@@ -13,0 +14,0 @@ const AuthenticationException_1 = require("../../Exceptions/AuthenticationException"); |
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DatabaseProvider = void 0; | ||
const hooks_1 = require("@poppinss/hooks"); | ||
@@ -13,0 +14,0 @@ const utils_1 = require("@poppinss/utils"); |
@@ -20,2 +20,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DatabaseUser = void 0; | ||
const fold_1 = require("@adonisjs/fold"); | ||
@@ -26,44 +27,47 @@ const utils_1 = require("@poppinss/utils"); | ||
*/ | ||
let DatabaseUser = class DatabaseUser { | ||
constructor(user, config, hash) { | ||
this.user = user; | ||
this.config = config; | ||
this.hash = hash; | ||
} | ||
/** | ||
* Returns the value of the user id | ||
*/ | ||
getId() { | ||
return this.user ? this.user[this.config.identifierKey] : null; | ||
} | ||
/** | ||
* Verifies the user password | ||
*/ | ||
async verifyPassword(plainPassword) { | ||
if (!this.user) { | ||
throw new utils_1.Exception('Cannot "verifyPassword" for non-existing user'); | ||
let DatabaseUser = /** @class */ (() => { | ||
let DatabaseUser = class DatabaseUser { | ||
constructor(user, config, hash) { | ||
this.user = user; | ||
this.config = config; | ||
this.hash = hash; | ||
} | ||
const hasher = this.config.hashDriver ? this.hash.use(this.config.hashDriver) : this.hash; | ||
return hasher.verify(this.user.password, plainPassword); | ||
} | ||
/** | ||
* Returns the user remember me token or null | ||
*/ | ||
getRememberMeToken() { | ||
return this.user ? (this.user.remember_me_token || null) : null; | ||
} | ||
/** | ||
* Updates user remember me token | ||
*/ | ||
setRememberMeToken(token) { | ||
if (!this.user) { | ||
throw new utils_1.Exception('Cannot set "rememberMeToken" on non-existing user'); | ||
/** | ||
* Returns the value of the user id | ||
*/ | ||
getId() { | ||
return this.user ? this.user[this.config.identifierKey] : null; | ||
} | ||
this.user.remember_me_token = token; | ||
} | ||
}; | ||
DatabaseUser = __decorate([ | ||
fold_1.inject([null, null, 'Adonis/Core/Hash']), | ||
__metadata("design:paramtypes", [Object, Object, Object]) | ||
], DatabaseUser); | ||
/** | ||
* Verifies the user password | ||
*/ | ||
async verifyPassword(plainPassword) { | ||
if (!this.user) { | ||
throw new utils_1.Exception('Cannot "verifyPassword" for non-existing user'); | ||
} | ||
const hasher = this.config.hashDriver ? this.hash.use(this.config.hashDriver) : this.hash; | ||
return hasher.verify(this.user.password, plainPassword); | ||
} | ||
/** | ||
* Returns the user remember me token or null | ||
*/ | ||
getRememberMeToken() { | ||
return this.user ? (this.user.remember_me_token || null) : null; | ||
} | ||
/** | ||
* Updates user remember me token | ||
*/ | ||
setRememberMeToken(token) { | ||
if (!this.user) { | ||
throw new utils_1.Exception('Cannot set "rememberMeToken" on non-existing user'); | ||
} | ||
this.user.remember_me_token = token; | ||
} | ||
}; | ||
DatabaseUser = __decorate([ | ||
fold_1.inject([null, null, 'Adonis/Core/Hash']), | ||
__metadata("design:paramtypes", [Object, Object, Object]) | ||
], DatabaseUser); | ||
return DatabaseUser; | ||
})(); | ||
exports.DatabaseUser = DatabaseUser; |
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LucidProvider = void 0; | ||
const hooks_1 = require("@poppinss/hooks"); | ||
@@ -13,0 +14,0 @@ const User_1 = require("./User"); |
@@ -20,2 +20,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LucidUser = void 0; | ||
const fold_1 = require("@adonisjs/fold"); | ||
@@ -26,44 +27,47 @@ const utils_1 = require("@poppinss/utils"); | ||
*/ | ||
let LucidUser = class LucidUser { | ||
constructor(user, config, hash) { | ||
this.user = user; | ||
this.config = config; | ||
this.hash = hash; | ||
} | ||
/** | ||
* Returns the value of the user id | ||
*/ | ||
getId() { | ||
return this.user ? this.user[this.config.identifierKey] : null; | ||
} | ||
/** | ||
* Verifies the user password | ||
*/ | ||
async verifyPassword(plainPassword) { | ||
if (!this.user) { | ||
throw new utils_1.Exception('Cannot "verifyPassword" for non-existing user'); | ||
let LucidUser = /** @class */ (() => { | ||
let LucidUser = class LucidUser { | ||
constructor(user, config, hash) { | ||
this.user = user; | ||
this.config = config; | ||
this.hash = hash; | ||
} | ||
const hasher = this.config.hashDriver ? this.hash.use(this.config.hashDriver) : this.hash; | ||
return hasher.verify(this.user.password, plainPassword); | ||
} | ||
/** | ||
* Returns the user remember me token or null | ||
*/ | ||
getRememberMeToken() { | ||
return this.user ? (this.user.rememberMeToken || null) : null; | ||
} | ||
/** | ||
* Updates user remember me token | ||
*/ | ||
setRememberMeToken(token) { | ||
if (!this.user) { | ||
throw new utils_1.Exception('Cannot set "rememberMeToken" on non-existing user'); | ||
/** | ||
* Returns the value of the user id | ||
*/ | ||
getId() { | ||
return this.user ? this.user[this.config.identifierKey] : null; | ||
} | ||
this.user.rememberMeToken = token; | ||
} | ||
}; | ||
LucidUser = __decorate([ | ||
fold_1.inject([null, null, 'Adonis/Core/Hash']), | ||
__metadata("design:paramtypes", [Object, Object, Object]) | ||
], LucidUser); | ||
/** | ||
* Verifies the user password | ||
*/ | ||
async verifyPassword(plainPassword) { | ||
if (!this.user) { | ||
throw new utils_1.Exception('Cannot "verifyPassword" for non-existing user'); | ||
} | ||
const hasher = this.config.hashDriver ? this.hash.use(this.config.hashDriver) : this.hash; | ||
return hasher.verify(this.user.password, plainPassword); | ||
} | ||
/** | ||
* Returns the user remember me token or null | ||
*/ | ||
getRememberMeToken() { | ||
return this.user ? (this.user.rememberMeToken || null) : null; | ||
} | ||
/** | ||
* Updates user remember me token | ||
*/ | ||
setRememberMeToken(token) { | ||
if (!this.user) { | ||
throw new utils_1.Exception('Cannot set "rememberMeToken" on non-existing user'); | ||
} | ||
this.user.rememberMeToken = token; | ||
} | ||
}; | ||
LucidUser = __decorate([ | ||
fold_1.inject([null, null, 'Adonis/Core/Hash']), | ||
__metadata("design:paramtypes", [Object, Object, Object]) | ||
], LucidUser); | ||
return LucidUser; | ||
})(); | ||
exports.LucidUser = LucidUser; |
@@ -12,2 +12,2 @@ "use strict"; | ||
var AuthenticationException_1 = require("./src/Exceptions/AuthenticationException"); | ||
exports.AuthenticationException = AuthenticationException_1.AuthenticationException; | ||
Object.defineProperty(exports, "AuthenticationException", { enumerable: true, get: function () { return AuthenticationException_1.AuthenticationException; } }); |
@@ -31,5 +31,5 @@ import { DateTime } from 'luxon' | ||
if ({{ modelReference }}.$dirty.password) { | ||
{{ modelReference }}.password = await Hash.hash({{ modelReference }}.password) | ||
{{ modelReference }}.password = await Hash.make({{ modelReference }}.password) | ||
} | ||
} | ||
} |
{ | ||
"name": "@adonisjs/auth", | ||
"version": "4.1.4", | ||
"version": "4.1.5", | ||
"description": "Offical authentication provider for Adonis framework", | ||
@@ -46,25 +46,25 @@ "types": "build/adonis-typings/index.d.ts", | ||
"devDependencies": { | ||
"@adonisjs/core": "^5.0.0-preview-rc-1.3", | ||
"@adonisjs/encryption": "^2.0.2", | ||
"@adonisjs/events": "^2.0.0", | ||
"@adonisjs/core": "^5.0.0-preview-rc-1.6", | ||
"@adonisjs/encryption": "^2.0.3", | ||
"@adonisjs/events": "^2.0.2", | ||
"@adonisjs/fold": "^6.3.5", | ||
"@adonisjs/hash": "^2.0.4", | ||
"@adonisjs/lucid": "^8.0.3", | ||
"@adonisjs/hash": "^3.1.0", | ||
"@adonisjs/lucid": "^8.1.1", | ||
"@adonisjs/mrm-preset": "^2.3.0", | ||
"@adonisjs/profiler": "^3.0.1", | ||
"@adonisjs/session": "^3.0.2", | ||
"@adonisjs/sink": "^3.0.1", | ||
"@adonisjs/profiler": "^3.0.3", | ||
"@adonisjs/session": "^3.0.3", | ||
"@adonisjs/sink": "^3.0.2", | ||
"@phc/bcrypt": "^1.0.2", | ||
"@poppinss/dev-utils": "^1.0.6", | ||
"@types/node": "^13.13.4", | ||
"@types/node": "^14.0.1", | ||
"commitizen": "^4.0.4", | ||
"copyfiles": "^2.2.0", | ||
"cz-conventional-changelog": "^3.1.0", | ||
"cz-conventional-changelog": "^3.2.0", | ||
"del-cli": "^3.0.0", | ||
"doctoc": "^1.4.0", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-adonis": "^1.0.9", | ||
"eslint": "^7.0.0", | ||
"eslint-plugin-adonis": "^1.0.10", | ||
"husky": "^4.2.5", | ||
"japa": "^3.0.1", | ||
"mrm": "^2.2.1", | ||
"mrm": "^2.3.0", | ||
"np": "^5.2.1", | ||
@@ -76,5 +76,5 @@ "pino-pretty": "^4.0.0", | ||
"supertest": "^4.0.2", | ||
"ts-essentials": "^6.0.4", | ||
"ts-node": "^8.9.1", | ||
"typescript": "^3.8.3" | ||
"ts-essentials": "^6.0.5", | ||
"ts-node": "^8.10.1", | ||
"typescript": "^3.9.2" | ||
}, | ||
@@ -81,0 +81,0 @@ "nyc": { |
101536
2622