forked from ProjectSegfault/publapi
generate password when reg script is run
This commit is contained in:
parent
e74b19616c
commit
5672b6a520
1
go.mod
1
go.mod
@ -12,7 +12,6 @@ require (
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/sethvargo/go-password v0.2.0 // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.43.0 // indirect
|
||||
|
@ -6,8 +6,6 @@ import (
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
"github.com/sethvargo/go-password/password"
|
||||
|
||||
"github.com/containrrr/shoutrrr"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -41,8 +39,9 @@ func SignupPage(c *fiber.Ctx) error {
|
||||
bashscript := "#!/bin/bash \n" +
|
||||
"# Path: /var/publapi/users/" + username + ".sh\n" +
|
||||
"# This file is generated by publapi. Do not edit this file.\n" +
|
||||
"pass=\"$(tr -dc A-Za-z0-9 </dev/urandom | head -c 64)\"" +
|
||||
"useradd -Um -s /bin/bash " + username + "\n" +
|
||||
"printf \"%s\\n%s\"" + " '" + pass + "' '" + pass + "' | passwd " + username + "\n" +
|
||||
"printf \"%s\\n%s\" \"${pass}\" \"${pass}\" | passwd " + username + "\n" +
|
||||
"echo \"" + username + "'s account has been created!\""
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user