feathers-authentication-management
Version:
Adds sign up verification, forgotten password reset, and other capabilities to local feathers-authentication
41 lines (40 loc) • 1.81 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthenticationManagementBase = void 0;
const errors_1 = require("@feathersjs/errors");
class AuthenticationManagementBase {
constructor(app) {
if (!app) {
throw new Error("Service from 'feathers-authentication-management' needs the 'app' as first constructor argument");
}
this.app = app;
}
create(data, params) {
return __awaiter(this, void 0, void 0, function* () {
if (Array.isArray(data)) {
return yield Promise.reject(new errors_1.MethodNotAllowed('authManagement does not handle multiple entries'));
}
return yield this._create(data, params);
});
}
get optionsWithApp() {
return Object.assign({ app: this.app }, this.options);
}
setup() {
return __awaiter(this, void 0, void 0, function* () {
if (typeof this.publish === 'function') {
this.publish(() => null);
}
});
}
}
exports.AuthenticationManagementBase = AuthenticationManagementBase;