FEATURE: Make initial admins TL1

* Match register controller TL to rake admin:create
* Don't promote if trust_level > 1
This commit is contained in:
James Kiesel 2018-08-22 00:45:24 -05:00 committed by Sam
parent 5a6d1ee257
commit cdea969c6a
2 changed files with 10 additions and 0 deletions

View File

@ -27,6 +27,7 @@ class FinishInstallationController < ApplicationController
@user.password_required!
if @user.save
@user.change_trust_level!(1) if @user.trust_level < 1
send_signup_email
return redirect_confirm(@user.email)
end

View File

@ -102,6 +102,15 @@ describe FinishInstallationController do
end
end
it "sets the admins trust level" do
post "/finish-installation/register.json", params: {
email: 'robin@example.com',
username: 'eviltrout',
password: 'disismypasswordokay'
}
expect(User.find_by(username: 'eviltrout').trust_level).to eq 1
end
end
end