@@ -10,7 +10,6 @@ import (
10
10
"sync"
11
11
"time"
12
12
13
- "github.com/NHAS/wag/internal/config"
14
13
"github.com/NHAS/wag/internal/data"
15
14
"github.com/NHAS/wag/internal/router"
16
15
"github.com/NHAS/wag/internal/users"
@@ -73,8 +72,15 @@ func (t *Totp) RegistrationAPI(w http.ResponseWriter, r *http.Request) {
73
72
switch r .Method {
74
73
case "GET" :
75
74
75
+ issuer , err := data .GetIssuer ()
76
+ if err != nil {
77
+ log .Println (user .Username , clientTunnelIp , "unable to get issuer from datastore" )
78
+
79
+ http .Error (w , "Bad request" , 400 )
80
+ return
81
+ }
76
82
key , err := totp .Generate (totp.GenerateOpts {
77
- Issuer : config . Values (). Authenticators . Issuer ,
83
+ Issuer : issuer ,
78
84
AccountName : user .Username ,
79
85
})
80
86
if err != nil {
@@ -210,17 +216,19 @@ func (t *Totp) AuthoriseFunc(w http.ResponseWriter, r *http.Request) types.Authe
210
216
}
211
217
212
218
func (t * Totp ) MFAPromptUI (w http.ResponseWriter , r * http.Request , username , ip string ) {
219
+
213
220
if err := resources .Render ("prompt_mfa_totp.html" , w , & resources.Msg {
214
- HelpMail : config . Values (). HelpMail ,
221
+ HelpMail : data . GetHelpMail () ,
215
222
NumMethods : NumberOfMethods (),
216
223
}); err != nil {
217
224
log .Println (username , ip , "unable to render totp prompt template: " , err )
218
225
}
219
226
}
220
227
221
228
func (t * Totp ) RegistrationUI (w http.ResponseWriter , r * http.Request , username , ip string ) {
229
+
222
230
if err := resources .Render ("register_mfa_totp.html" , w , & resources.Msg {
223
- HelpMail : config . Values (). HelpMail ,
231
+ HelpMail : data . GetHelpMail () ,
224
232
NumMethods : NumberOfMethods (),
225
233
}); err != nil {
226
234
log .Println (username , ip , "unable to render totp mfa template: " , err )
0 commit comments