ThomasTJdev / nim_websitecreator

Nim fullstack website framework - deploy a website within minutes
https://nimwc.org
MIT License
176 stars 7 forks source link

Move `createAdminUser` out of nimwc_main.nim #57

Closed ThomasTJdev closed 5 years ago

ThomasTJdev commented 5 years ago

We need to move createAdminUser out of nimwc_main.nim and use it in nimwc.nim. If it fails, due to doAssert, the launcher function will restart nimwc_main and try again again. The end user will also have a hard time seeing the error message due to the verbosity of firejail.

Moving it til nimwc.nim will require to establish a DB connection already there. I have changed doAssert to if and inserted a sleep and return as a temporary solution.

   # Add admin user
  if "newuser" in commandLineParams():
    createAdminUser(db, commandLineParams())
  # TODO
  if iName.len < 3:
    error("Missing or invalid Name to create Admin user: " & iName)
    sleep(3000)
    return
juancarlospaco commented 5 years ago

createAdminUser() is Not on nimwc_main.nim anymore. Closing...