validate passwords and fix home

This commit is contained in:
Josh
2018-06-08 14:44:08 -04:00
parent 520c489e62
commit 4f70c9a8e5
9 changed files with 54 additions and 69 deletions

View File

@ -12,10 +12,9 @@ class User < ApplicationRecord
uniqueness: { case_sensitive: false },
format: {with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }
validates :password, length: { minimum: 6 }, allow_nil: true
validates :password, length: { minimum: 6 }, presence: true, confirmation: true, if: :greenlight_account?
# We don't want to run the validations because they require a user
# to have a password. Users who authenticate via omniauth won't.
# We don't want to require password validations on all accounts.
has_secure_password(validations: false)
class << self
@ -90,6 +89,10 @@ class User < ApplicationRecord
name.split(' ').first
end
def greenlight_account?
provider == "greenlight"
end
private
# Initializes a room for the user and assign a BigBlueButton user id.