Added flash messages for company sign up

This commit is contained in:
Okechi Onyeje 2017-03-30 12:18:07 -04:00
parent b1bb0f69ad
commit 7f03001238

View File

@ -22,14 +22,27 @@ class RegistrationsController < Devise::RegistrationsController
if company.company_name == "IVA" if company.company_name == "IVA"
@user.admin = true @user.admin = true
end end
else
flash[:alert] = "The serial key provided was invalid."
redirect_to '/'
end end
else
flash[:alert] = "A company serial key must be provided to register."
redirect_to '/'
end end
@user.save
sign_in @user if @user == ""
if !@user.admin flash[:alert] = "Please provide a password to register with."
Apartment::Tenant.switch(Company.find(@user.company_id).company_name.gsub(/'/,'').gsub(/\s/,'')) redirect_to '/'
else
@user.save
sign_in @user
if !@user.admin
Apartment::Tenant.switch(Company.find(@user.company_id).company_name.gsub(/'/,'').gsub(/\s/,''))
end
redirect_to "/" and return
end end
redirect_to "/" and return
end end
private private