Remove misc files, add root permission, and update env template
This commit is contained in:
@@ -76,7 +76,20 @@ class AuthController extends Controller {
|
||||
trap: 'password_reset', // Force user to reset password
|
||||
})
|
||||
|
||||
user.promote('base_user')
|
||||
const Setting = this.models.get('Setting')
|
||||
try {
|
||||
const default_roles = await Setting.get('auth.default_roles')
|
||||
if ( Array.isArray(default_roles) ) {
|
||||
for ( const role of default_roles ) user.promote(role)
|
||||
}
|
||||
} catch (e) {
|
||||
this.output.error('Unable to read default roles to promote registered user: ')
|
||||
this.output.error(e)
|
||||
}
|
||||
|
||||
// If this is the first user, make them root
|
||||
if ( !(await User.findOne()) ) user.promote('root')
|
||||
|
||||
await user.save()
|
||||
|
||||
// Log in the user automatically
|
||||
|
||||
Reference in New Issue
Block a user