diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-29 16:09:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-29 16:09:50 +0100 |
commit | ba12e8b3a6de8ac82101894abe7460b392fec42a (patch) | |
tree | 5f75741fde6b3be093c885c23c582b6d0d3cec20 /server/models | |
parent | 61c04fa9b3566b769b260e414fe59df77cd77031 (diff) | |
download | PeerTube-ba12e8b3a6de8ac82101894abe7460b392fec42a.tar.gz PeerTube-ba12e8b3a6de8ac82101894abe7460b392fec42a.tar.zst PeerTube-ba12e8b3a6de8ac82101894abe7460b392fec42a.zip |
Add ability to login with email
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/user.ts | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 8eb88062a..809e821bd 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -121,17 +121,6 @@ export class UserModel extends Model<UserModel> { | |||
121 | return this.count() | 121 | return this.count() |
122 | } | 122 | } |
123 | 123 | ||
124 | static getByUsername (username: string) { | ||
125 | const query = { | ||
126 | where: { | ||
127 | username: username | ||
128 | }, | ||
129 | include: [ { model: AccountModel, required: true } ] | ||
130 | } | ||
131 | |||
132 | return UserModel.findOne(query) | ||
133 | } | ||
134 | |||
135 | static listForApi (start: number, count: number, sort: string) { | 124 | static listForApi (start: number, count: number, sort: string) { |
136 | const query = { | 125 | const query = { |
137 | offset: start, | 126 | offset: start, |
@@ -172,7 +161,9 @@ export class UserModel extends Model<UserModel> { | |||
172 | return UserModel.scope('withVideoChannel').findOne(query) | 161 | return UserModel.scope('withVideoChannel').findOne(query) |
173 | } | 162 | } |
174 | 163 | ||
175 | static loadByUsernameOrEmail (username: string, email: string) { | 164 | static loadByUsernameOrEmail (username: string, email?: string) { |
165 | if (!email) email = username | ||
166 | |||
176 | const query = { | 167 | const query = { |
177 | where: { | 168 | where: { |
178 | [ Sequelize.Op.or ]: [ { username }, { email } ] | 169 | [ Sequelize.Op.or ]: [ { username }, { email } ] |