mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Fix #2272
This commit is contained in:
parent
01d71a767d
commit
7a73ddbe12
|
|
@ -23,14 +23,12 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/matrix-org/dendrite/setup/base"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"golang.org/x/term"
|
||||
|
||||
"github.com/matrix-org/dendrite/setup"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
"github.com/matrix-org/dendrite/userapi/api"
|
||||
userdb "github.com/matrix-org/dendrite/userapi/storage"
|
||||
)
|
||||
|
||||
const usage = `Usage: %s
|
||||
|
|
@ -80,23 +78,14 @@ func main() {
|
|||
|
||||
pass := getPassword(password, pwdFile, pwdStdin, askPass, os.Stdin)
|
||||
|
||||
accountDB, err := userdb.NewDatabase(
|
||||
&config.DatabaseOptions{
|
||||
ConnectionString: cfg.UserAPI.AccountDatabase.ConnectionString,
|
||||
},
|
||||
cfg.Global.ServerName, bcrypt.DefaultCost,
|
||||
cfg.UserAPI.OpenIDTokenLifetimeMS,
|
||||
api.DefaultLoginTokenLifetime,
|
||||
)
|
||||
if err != nil {
|
||||
logrus.Fatalln("Failed to connect to the database:", err.Error())
|
||||
}
|
||||
b := base.NewBaseDendrite(cfg, "create-account")
|
||||
accountDB := b.CreateAccountsDB()
|
||||
|
||||
accType := api.AccountTypeUser
|
||||
if *isAdmin {
|
||||
accType = api.AccountTypeAdmin
|
||||
}
|
||||
|
||||
var err error
|
||||
if *resetPassword {
|
||||
err = accountDB.SetPassword(context.Background(), *username, pass)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue