refactor: Change to using rand.Read instead of whatever the hell else was before

This commit is contained in:
Matthew
2023-11-27 01:08:40 -05:00
parent d2e9e3d1a9
commit 38b57c6d98
3 changed files with 8 additions and 12 deletions

View File

@@ -86,10 +86,11 @@ func (s *Server) onInteraction(ds *discordgo.Session, i *discordgo.InteractionCr
return
}
break
case "passwordreset":
case "password":
password, _ := bcrypt.GenerateFromPassword([]byte(i.ApplicationCommandData().Options[0].StringValue()), 10)
_, err := s.db.Exec("UPDATE users SET password = $1 WHERE discord_id = $2", password, i.Member.User.ID)
if err != nil {
s.logger.Error(fmt.Sprint(err))
return
}
err = ds.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{