mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-08-13 14:27:27 +00:00
join@: require accepting acceptable-use terms (no illegal activity) before registering
New members must read a short terms notice and type "agree" before an account is created. The terms state that AgentBBS is for lawful use only, that illegal activity results in an immediate permanent ban (and may be reported), and that members are responsible for what they and their agents do. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3b6b9a4a78
commit
f270a80d13
1 changed files with 35 additions and 2 deletions
|
|
@ -434,9 +434,15 @@ func (a *app) handleJoin(s ssh.Session) {
|
|||
return
|
||||
}
|
||||
if !found {
|
||||
// New key: let the visitor pick their own handle before we create the
|
||||
// account (a returning key keeps the name it already chose).
|
||||
// New key: show the acceptable-use terms and require acceptance before
|
||||
// creating the account, then let the visitor pick their own handle (a
|
||||
// returning key keeps the name it already chose).
|
||||
wish.Println(s, "\n Welcome to AgentBBS — let's set up your account.")
|
||||
if !a.acceptTerms(s, in) {
|
||||
wish.Println(s, "\n You must accept the terms to register — no account was created.")
|
||||
_ = s.Exit(1)
|
||||
return
|
||||
}
|
||||
if u, err = a.registerNewMember(s, in, fp); err != nil {
|
||||
wish.Fatalln(s, "registration error: "+err.Error())
|
||||
return
|
||||
|
|
@ -474,6 +480,33 @@ func (a *app) handleJoin(s ssh.Session) {
|
|||
_ = s.Exit(0)
|
||||
}
|
||||
|
||||
// acceptTerms shows the acceptable-use terms and requires the visitor to type
|
||||
// "agree" before an account is created. AgentBBS is for lawful use only; illegal
|
||||
// activity is grounds for an immediate, permanent ban. Returns true on acceptance.
|
||||
func (a *app) acceptTerms(s ssh.Session, in *bufio.Reader) bool {
|
||||
wish.Println(s, "\n"+strings.Join([]string{
|
||||
" Terms of use — please read before you join:",
|
||||
" • AgentBBS is for LAWFUL use only. Illegal activity is not permitted",
|
||||
" and will result in an immediate, permanent ban — and may be reported",
|
||||
" to the relevant authorities.",
|
||||
" • Don't abuse the service, other members, or the shared infrastructure,",
|
||||
" and don't use it to harm others.",
|
||||
" • You are responsible for everything you — and any agents you run —",
|
||||
" do here.",
|
||||
}, "\n"))
|
||||
wish.Print(s, "\n Type \"agree\" to accept and continue: ")
|
||||
line, err := readLine(s, in)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
switch strings.ToLower(strings.TrimSpace(line)) {
|
||||
case "agree", "i agree", "agreed", "yes", "y":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// registerNewMember asks the visitor to choose a username, then creates their
|
||||
// member account under it. The name is sanitized to the hub/subdomain charset,
|
||||
// rejected if reserved, and must be free; pressing enter accepts a generated
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue