CoC prompt

trunk
vilmibm 2023-03-06 21:00:59 +00:00
parent d407e26917
commit 09269126d8
2 changed files with 28 additions and 2 deletions

View File

@ -29,6 +29,18 @@ func promptCode() (code string, err error) {
return return
} }
func confirmCoC() (conf bool, err error) {
err = survey.AskOne(
&survey.Confirm{
Message: "do you agree to the above CoC?",
Default: true,
}, &conf,
survey.WithValidator(survey.Required),
survey.WithIcons(surveyIconSet))
return
}
func confirmContinue() (conf bool, err error) { func confirmContinue() (conf bool, err error) {
err = survey.AskOne( err = survey.AskOne(
&survey.Confirm{ &survey.Confirm{

View File

@ -19,7 +19,6 @@ import (
// TODO add logging like the signup tool has // TODO add logging like the signup tool has
// TODO consider merging adduser, usermod, and createkeyfile into single createuser helper to limit sudoers list // TODO consider merging adduser, usermod, and createkeyfile into single createuser helper to limit sudoers list
// TODO move magic key machine to static page // TODO move magic key machine to static page
// TODO link to code of conduct as part of the form and ask if they agree
// TODO add alerts for new users (mailing list post, irc post, etc(?)) // TODO add alerts for new users (mailing list post, irc post, etc(?))
//go:embed welcome.txt //go:embed welcome.txt
@ -102,7 +101,22 @@ func _main() error {
} }
} }
s = s.SetString("cool, awesome, going to make your account now...") s = s.SetString("town users all agree to our code of conduct: https://tilde.town/wiki/conduct.html")
fmt.Println(s)
coc, err := confirmCoC()
if err != nil {
return err
}
if !coc {
s = s.SetString("bummer. have a good one.")
fmt.Println(s)
return nil
}
s = s.SetString("cool, awesome, thank you, going to make your account now...")
fmt.Println(s) fmt.Println(s)
if err = createUser(*data); err != nil { if err = createUser(*data); err != nil {