Adding autobind decorator to server

This commit is contained in:
John Lyon-Smith
2018-03-26 11:37:18 -07:00
parent 80c37f8642
commit 49ca7f3bf1
18 changed files with 51 additions and 55 deletions

View File

@@ -6,9 +6,10 @@ import crypto from 'crypto'
import urlSafeBase64 from 'urlsafe-base64'
import util from 'util'
import * as loginToken from './loginToken'
import autoBind from 'auto-bind2'
import autobind from 'autobind-decorator'
import url from 'url'
@autobind
export class AuthRoutes {
constructor(container) {
const app = container.app
@@ -20,7 +21,6 @@ export class AuthRoutes {
this.sendEmailDelayInSeconds = config.get('email.sendEmailDelayInSeconds')
this.supportEmail = config.get('email.supportEmail')
this.sendEmail = config.get('email.sendEmail')
autoBind(this)
app.route('/auth/login')
// Used to login. Email must be confirmed.
.post(this.login)
@@ -194,7 +194,7 @@ export class AuthRoutes {
if (this.sendEmail) {
await this.mq.request('dar-email', 'sendEmail', msgs)
}
res.json({})
} catch(err) {
if (err instanceof createError.HttpError) {