Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix/connection with email (#1917)

Nassim Bounouas50b4dcce5627
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index bbf06c87fb..1672ebfa9b 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -181,13 +181,13 @@ Then, we can create the databases (if they don't already exist):
```
$ sudo -u postgres createuser you_username --createdb --superuser
-$ createdb -O peertube peertube_test{1,2,3,4,5,6}
+$ npm run clean:server:test
```
Build the application and run the unit/integration tests:
```
-$ npm run build
+$ npm run build -- --light
$ npm test
```
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 4fc04a05c1..eaa822e0f9 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -153,7 +153,7 @@ export class AuthService {
response_type: 'code',
grant_type: 'password',
scope: 'upload',
- username: username.toLowerCase(),
+ username,
password
}
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index aac691d66f..0f425bb820 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -367,7 +367,7 @@ export class UserModel extends Model<UserModel> {
static loadByUsername (username: string) {
const query = {
where: {
- username
+ username: { [ Op.iLike ]: username }
}
}
@@ -377,7 +377,7 @@ export class UserModel extends Model<UserModel> {
static loadByUsernameAndPopulateChannels (username: string) {
const query = {
where: {
- username
+ username: { [ Op.iLike ]: username }
}
}
@@ -399,7 +399,7 @@ export class UserModel extends Model<UserModel> {
const query = {
where: {
- [ Op.or ]: [ { username }, { email } ]
+ [ Op.or ]: [ { username: { [ Op.iLike ]: username } }, { email } ]
}
}
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 403d1a0897..6fc2a070f3 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -116,6 +116,17 @@ describe('Test users', function () {
accessToken = res.body.access_token
})
+
+ it('Should be able to login with an insensitive username', async function () {
+ const user = { username: 'RoOt', password: server.user.password }
+ const res = await login(server.url, server.client, user, 200)
+
+ const user2 = { username: 'rOoT', password: server.user.password }
+ const res2 = await login(server.url, server.client, user2, 200)
+
+ const user3 = { username: 'ROOt', password: server.user.password }
+ const res3 = await login(server.url, server.client, user3, 200)
+ })
})
describe('Upload', function () {