Compare commits
No commits in common. "674107915225dc1905f45ef3d5d42c9666aa92df" and "4847c19eafd45ecfe90ea787858f4e69259cfabf" have entirely different histories.
6741079152
...
4847c19eaf
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/mail"
|
"net/mail"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -245,41 +244,12 @@ func _main() error {
|
||||||
s = s.SetString("cool, awesome, going to make your account now...")
|
s = s.SetString("cool, awesome, going to make your account now...")
|
||||||
fmt.Println(s)
|
fmt.Println(s)
|
||||||
|
|
||||||
if err = createUser(*data); err != nil {
|
// TODO have enough to make account; can now do that
|
||||||
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
|
// TODO assuming account creation succeeded, mark invite as used
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add logging like the signup tool has
|
|
||||||
|
|
||||||
func createUser(data newUserData) (err error) {
|
|
||||||
cmd := exec.Command("sudo", "/usr/sbin/adduser", "--quiet", "--disabled-password", data.Username)
|
|
||||||
if err = cmd.Run(); err != nil {
|
|
||||||
return fmt.Errorf("adduser failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd = exec.Command("sudo", "/usr/sbin/usermod", "-a", "-G", "town", data.Username)
|
|
||||||
if err = cmd.Run(); err != nil {
|
|
||||||
return fmt.Errorf("usermod failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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() {
|
func main() {
|
||||||
// TODO friendlier error handling
|
// TODO friendlier error handling
|
||||||
err := _main()
|
err := _main()
|
||||||
|
|
Loading…
Reference in New Issue