mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Don't show Link to TOTP if not set up (#27585)
This commit is contained in:
		@@ -37,6 +37,14 @@ func WebAuthn(ctx *context.Context) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						hasTwoFactor, err := auth.HasTwoFactorByUID(ctx, ctx.Session.Get("twofaUid").(int64))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							ctx.ServerError("HasTwoFactorByUID", err)
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ctx.Data["HasTwoFactor"] = hasTwoFactor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctx.HTML(http.StatusOK, tplWebAuthn)
 | 
						ctx.HTML(http.StatusOK, tplWebAuthn)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,9 +14,11 @@
 | 
				
			|||||||
				<div class="is-loading" style="width: 40px; height: 40px"></div>
 | 
									<div class="is-loading" style="width: 40px; height: 40px"></div>
 | 
				
			||||||
				{{ctx.Locale.Tr "webauthn_press_button"}}
 | 
									{{ctx.Locale.Tr "webauthn_press_button"}}
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			<div class="ui attached segment">
 | 
								{{if .HasTwoFactor}}
 | 
				
			||||||
				<a href="{{AppSubUrl}}/user/two_factor">{{ctx.Locale.Tr "webauthn_use_twofa"}}</a>
 | 
									<div class="ui attached segment">
 | 
				
			||||||
			</div>
 | 
										<a href="{{AppSubUrl}}/user/two_factor">{{ctx.Locale.Tr "webauthn_use_twofa"}}</a>
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
 | 
								{{end}}
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user