Working on signup and signin

This commit is contained in:
Kyle Drake 2013-05-25 13:57:17 -07:00
parent 50882756d0
commit 4ddd244588
12 changed files with 105 additions and 11 deletions

View file

@ -34,17 +34,17 @@ class Site < Sequel::Model
super
if values[:username].nil? || values[:username].empty?
errors.add :username, 'valid username is required'
errors.add :username, 'A valid username is required.'
end
# Check for existing user
user = self.class.select(:username).filter(username: values[:username]).first
if !user.nil? && (user.id != values[:id])
errors.add :username, 'this username is already taken'
errors.add :username, 'This username is already taken. Try using another one.'
end
if values[:password].nil? || (@password_length && @password_length < MINIMUM_PASSWORD_LENGTH)
errors.add :password, "password must be at least #{MINIMUM_PASSWORD_LENGTH} characters"
errors.add :password, "Password must be at least #{MINIMUM_PASSWORD_LENGTH} characters."
end
end
end