@@ -213,9 +213,9 @@ func SignInPost(ctx *context.Context) {
213213
214214 // If this user is enrolled in 2FA, we can't sign the user in just yet.
215215 // Instead, redirect them to the 2FA authentication page.
216- _ , err = models .GetTwoFactorByUID (u .ID )
216+ _ , err = login .GetTwoFactorByUID (u .ID )
217217 if err != nil {
218- if models .IsErrTwoFactorNotEnrolled (err ) {
218+ if login .IsErrTwoFactorNotEnrolled (err ) {
219219 handleSignIn (ctx , u , form .Remember )
220220 } else {
221221 ctx .ServerError ("UserSignIn" , err )
@@ -237,7 +237,7 @@ func SignInPost(ctx *context.Context) {
237237 return
238238 }
239239
240- regs , err := models .GetU2FRegistrationsByUID (u .ID )
240+ regs , err := login .GetU2FRegistrationsByUID (u .ID )
241241 if err == nil && len (regs ) > 0 {
242242 ctx .Redirect (setting .AppSubURL + "/user/u2f" )
243243 return
@@ -277,7 +277,7 @@ func TwoFactorPost(ctx *context.Context) {
277277 }
278278
279279 id := idSess .(int64 )
280- twofa , err := models .GetTwoFactorByUID (id )
280+ twofa , err := login .GetTwoFactorByUID (id )
281281 if err != nil {
282282 ctx .ServerError ("UserSignIn" , err )
283283 return
@@ -313,7 +313,7 @@ func TwoFactorPost(ctx *context.Context) {
313313 }
314314
315315 twofa .LastUsedPasscode = form .Passcode
316- if err = models .UpdateTwoFactor (twofa ); err != nil {
316+ if err = login .UpdateTwoFactor (twofa ); err != nil {
317317 ctx .ServerError ("UserSignIn" , err )
318318 return
319319 }
@@ -356,7 +356,7 @@ func TwoFactorScratchPost(ctx *context.Context) {
356356 }
357357
358358 id := idSess .(int64 )
359- twofa , err := models .GetTwoFactorByUID (id )
359+ twofa , err := login .GetTwoFactorByUID (id )
360360 if err != nil {
361361 ctx .ServerError ("UserSignIn" , err )
362362 return
@@ -370,7 +370,7 @@ func TwoFactorScratchPost(ctx *context.Context) {
370370 ctx .ServerError ("UserSignIn" , err )
371371 return
372372 }
373- if err = models .UpdateTwoFactor (twofa ); err != nil {
373+ if err = login .UpdateTwoFactor (twofa ); err != nil {
374374 ctx .ServerError ("UserSignIn" , err )
375375 return
376376 }
@@ -418,7 +418,7 @@ func U2FChallenge(ctx *context.Context) {
418418 return
419419 }
420420 id := idSess .(int64 )
421- regs , err := models .GetU2FRegistrationsByUID (id )
421+ regs , err := login .GetU2FRegistrationsByUID (id )
422422 if err != nil {
423423 ctx .ServerError ("UserSignIn" , err )
424424 return
@@ -454,7 +454,7 @@ func U2FSign(ctx *context.Context) {
454454 }
455455 challenge := challSess .(* u2f.Challenge )
456456 id := idSess .(int64 )
457- regs , err := models .GetU2FRegistrationsByUID (id )
457+ regs , err := login .GetU2FRegistrationsByUID (id )
458458 if err != nil {
459459 ctx .ServerError ("UserSignIn" , err )
460460 return
@@ -717,8 +717,8 @@ func handleOAuth2SignIn(ctx *context.Context, source *login.Source, u *models.Us
717717
718718 needs2FA := false
719719 if ! source .Cfg .(* oauth2.Source ).SkipLocalTwoFA {
720- _ , err := models .GetTwoFactorByUID (u .ID )
721- if err != nil && ! models .IsErrTwoFactorNotEnrolled (err ) {
720+ _ , err := login .GetTwoFactorByUID (u .ID )
721+ if err != nil && ! login .IsErrTwoFactorNotEnrolled (err ) {
722722 ctx .ServerError ("UserSignIn" , err )
723723 return
724724 }
@@ -775,7 +775,7 @@ func handleOAuth2SignIn(ctx *context.Context, source *login.Source, u *models.Us
775775 }
776776
777777 // If U2F is enrolled -> Redirect to U2F instead
778- regs , err := models .GetU2FRegistrationsByUID (u .ID )
778+ regs , err := login .GetU2FRegistrationsByUID (u .ID )
779779 if err == nil && len (regs ) > 0 {
780780 ctx .Redirect (setting .AppSubURL + "/user/u2f" )
781781 return
@@ -935,9 +935,9 @@ func linkAccount(ctx *context.Context, u *models.User, gothUser goth.User, remem
935935 // If this user is enrolled in 2FA, we can't sign the user in just yet.
936936 // Instead, redirect them to the 2FA authentication page.
937937 // We deliberately ignore the skip local 2fa setting here because we are linking to a previous user here
938- _ , err := models .GetTwoFactorByUID (u .ID )
938+ _ , err := login .GetTwoFactorByUID (u .ID )
939939 if err != nil {
940- if ! models .IsErrTwoFactorNotEnrolled (err ) {
940+ if ! login .IsErrTwoFactorNotEnrolled (err ) {
941941 ctx .ServerError ("UserLinkAccount" , err )
942942 return
943943 }
@@ -967,7 +967,7 @@ func linkAccount(ctx *context.Context, u *models.User, gothUser goth.User, remem
967967 }
968968
969969 // If U2F is enrolled -> Redirect to U2F instead
970- regs , err := models .GetU2FRegistrationsByUID (u .ID )
970+ regs , err := login .GetU2FRegistrationsByUID (u .ID )
971971 if err == nil && len (regs ) > 0 {
972972 ctx .Redirect (setting .AppSubURL + "/user/u2f" )
973973 return
@@ -1561,7 +1561,7 @@ func ForgotPasswdPost(ctx *context.Context) {
15611561 ctx .HTML (http .StatusOK , tplForgotPassword )
15621562}
15631563
1564- func commonResetPassword (ctx * context.Context ) (* models.User , * models .TwoFactor ) {
1564+ func commonResetPassword (ctx * context.Context ) (* models.User , * login .TwoFactor ) {
15651565 code := ctx .FormString ("code" )
15661566
15671567 ctx .Data ["Title" ] = ctx .Tr ("auth.reset_password" )
@@ -1583,9 +1583,9 @@ func commonResetPassword(ctx *context.Context) (*models.User, *models.TwoFactor)
15831583 return nil , nil
15841584 }
15851585
1586- twofa , err := models .GetTwoFactorByUID (u .ID )
1586+ twofa , err := login .GetTwoFactorByUID (u .ID )
15871587 if err != nil {
1588- if ! models .IsErrTwoFactorNotEnrolled (err ) {
1588+ if ! login .IsErrTwoFactorNotEnrolled (err ) {
15891589 ctx .Error (http .StatusInternalServerError , "CommonResetPassword" , err .Error ())
15901590 return nil , nil
15911591 }
@@ -1680,7 +1680,7 @@ func ResetPasswdPost(ctx *context.Context) {
16801680 }
16811681
16821682 twofa .LastUsedPasscode = passcode
1683- if err = models .UpdateTwoFactor (twofa ); err != nil {
1683+ if err = login .UpdateTwoFactor (twofa ); err != nil {
16841684 ctx .ServerError ("ResetPasswdPost: UpdateTwoFactor" , err )
16851685 return
16861686 }
@@ -1712,7 +1712,7 @@ func ResetPasswdPost(ctx *context.Context) {
17121712 ctx .ServerError ("UserSignIn" , err )
17131713 return
17141714 }
1715- if err = models .UpdateTwoFactor (twofa ); err != nil {
1715+ if err = login .UpdateTwoFactor (twofa ); err != nil {
17161716 ctx .ServerError ("UserSignIn" , err )
17171717 return
17181718 }
0 commit comments