diff --git a/lurkcoin/api/admin-pages.go b/lurkcoin/api/admin-pages.go
index 60ad7dd..ec604e8 100644
--- a/lurkcoin/api/admin-pages.go
+++ b/lurkcoin/api/admin-pages.go
@@ -152,7 +152,7 @@ const serverListTemplate = adminPagesHeader + `
const currencyInput = `type="text" pattern="¤?[0-9,_]+(\.[0-9,_]+)?"`
const infoTemplate = adminPagesHeader + `
@@ -209,6 +221,12 @@ const infoTemplate = adminPagesHeader + `
disabled="disabled" name="webhookURL" />
{{if .AllowEditing}}
+
+
+
@@ -610,6 +628,20 @@ func addAdminPages(router *httprouter.Router, db lurkcoin.Database,
)
}
+ if r.Form.Get("regenerateToken") == "on" {
+ if len(msgs) == 0 {
+ msgs = append(msgs, "New token: "+server.RegenerateToken())
+ log.Printf(
+ "[Admin] User %#v regenerates the token of server %#v",
+ adminUser,
+ server.Name,
+ )
+ } else {
+ msgs = append(msgs, "Refusing to regenerate token as other"+
+ " settings were changed.")
+ }
+ }
+
// Finish the transaction
uid := server.UID
tr.Finish()
diff --git a/lurkcoin/misc.go b/lurkcoin/misc.go
index 50a76fe..2ceb064 100644
--- a/lurkcoin/misc.go
+++ b/lurkcoin/misc.go
@@ -35,7 +35,7 @@ import (
)
const SYMBOL = "¤"
-const VERSION = "3.0.7"
+const VERSION = "3.0.8"
// Note that public source code is required by the AGPL
const SOURCE_URL = "https://github.com/luk3yx/lurkcoin-core"
diff --git a/lurkcoin/servers.go b/lurkcoin/servers.go
index bc7e511..fcbe526 100644
--- a/lurkcoin/servers.go
+++ b/lurkcoin/servers.go
@@ -323,6 +323,15 @@ func (self *Server) GetExchangeRate(amount Currency, toLurkcoin bool) (Currency,
return CurrencyFromFloat(res), exchange
}
+// Regenerates the token and returns the new one.
+func (self *Server) RegenerateToken() string {
+ self.lock.Lock()
+ defer self.lock.Unlock()
+ self.token = GenerateToken()
+ self.modified = true
+ return self.token
+}
+
// "Encoded" servers that have all their values public
type EncodedServer struct {
// A version number for breaking changes, because of the way gob works this