Allow longer passwords (#923)

This commit is contained in:
kidhab 2022-02-16 18:13:08 +01:00 committed by GitHub
parent daccf91ab6
commit 64ab699047
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View file

@ -23,28 +23,28 @@ describe User do
end
describe do
let(:user) { create :user, password: 'blahblah' }
let(:user) { create :user, password: 'blahblahblah' }
it 'can authenticate with correct password' do
expect(User.authenticate(user.nick, 'blahblah')).to be_truthy
expect(User.authenticate(user.nick, 'blahblahblah')).to be_truthy
end
it 'can not authenticate with incorrect password' do
expect(User.authenticate(user.nick, 'foobar')).to be_nil
end
it 'can not authenticate with nil nick' do
expect(User.authenticate(nil, 'blahblah')).to be_nil
expect(User.authenticate(nil, 'blahblahblah')).to be_nil
end
it 'can not authenticate with nil password' do
expect(User.authenticate(user.nick, nil)).to be_nil
end
it 'can not set a password without matching confirmation' do
user.password = 'abcdefghij'
user.password_confirmation = 'foobarxyz'
user.password = 'abcdefghijkl'
user.password_confirmation = 'foobaruvwxyz'
expect(user).to be_invalid
end
it 'can set a password with matching confirmation' do
user.password = 'abcdefghij'
user.password_confirmation = 'abcdefghij'
user.password = 'abcdefghijkl'
user.password_confirmation = 'abcdefghijkl'
expect(user).to be_valid
end
@ -56,13 +56,13 @@ describe User do
end
it 'can authenticate using email address' do
expect(User.authenticate(user.email, 'blahblah')).to be_truthy
expect(User.authenticate(user.email, 'blahblahblah')).to be_truthy
end
it 'can authenticate when there is no nick' do
user.nick = nil
expect(user).to be_valid
expect(User.authenticate(user.email, 'blahblah')).to be_truthy
expect(User.authenticate(user.email, 'blahblahblah')).to be_truthy
end
end