File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,14 @@ import (
2020)
2121
2222func GenerateTOTP (c * gin.Context ) {
23- user := api .CurrentUser (c )
23+ u := api .CurrentUser (c )
2424
2525 issuer := fmt .Sprintf ("Nginx UI %s" , settings .ServerSettings .Name )
2626 issuer = strings .TrimSpace (issuer )
2727
2828 otpOpts := totp.GenerateOpts {
2929 Issuer : issuer ,
30- AccountName : user .Name ,
30+ AccountName : u .Name ,
3131 Period : 30 , // seconds
3232 Digits : otp .DigitsSix ,
3333 Algorithm : otp .AlgorithmSHA1 ,
@@ -76,6 +76,13 @@ func EnrollTOTP(c *gin.Context) {
7676 return
7777 }
7878
79+ if settings .ServerSettings .Demo {
80+ c .JSON (http .StatusBadRequest , gin.H {
81+ "message" : "This feature is disabled in demo mode" ,
82+ })
83+ return
84+ }
85+
7986 var json struct {
8087 Secret string `json:"secret" binding:"required"`
8188 Passcode string `json:"passcode" binding:"required"`
You can’t perform that action at this time.
0 commit comments