From 3940fe58ae5e1498004f2290ebc28c5b0cc9c9cb Mon Sep 17 00:00:00 2001 From: vilmibm Date: Fri, 3 Mar 2023 21:29:13 +0000 Subject: [PATCH] WIP user creation --- cmd/welcome/main.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cmd/welcome/main.go b/cmd/welcome/main.go index 24e0baf..4b61ffc 100644 --- a/cmd/welcome/main.go +++ b/cmd/welcome/main.go @@ -244,12 +244,31 @@ func _main() error { s = s.SetString("cool, awesome, going to make your account now...") fmt.Println(s) - // TODO have enough to make account; can now do that + if err = createUser(*data); err != nil { + s = s.SetString(fmt.Sprintf(`augh, I'm sorry. the account creation failed. +Please email root@tilde.town and paste the following error: + +%s + +Your invite code has not been marked as used and you're welcome to try again, though if there is a system issue you might need to wait for word from an admin.`, err.Error())) + fmt.Println(s) + return nil + } + // TODO assuming account creation succeeded, mark invite as used return nil } +func createUser(data newUserData) error { + // TODO adduser + // TODO add to town group + // TODO create keyfile by running helper (helper should also make ~/.ssh) + // TODO generate welcome gift + // TODO any alerts + return errors.New("not implemented") +} + func main() { // TODO friendlier error handling err := _main()