feat: otp resolvers updated

This commit is contained in:
anik-ghosh-au7
2022-07-29 13:49:46 +05:30
parent e3c58ffbb0
commit 4e3d73e767
7 changed files with 195 additions and 3 deletions

View File

@@ -99,6 +99,12 @@ func LoginResolver(ctx context.Context, params model.LoginInput) (*model.AuthRes
}
if refs.BoolValue(user.IsMultiFactorAuthEnabled) {
//TODO - send email based on email config
db.Provider.UpsertOTP(ctx, &models.OTP{
Email: user.Email,
Otp: utils.GenerateOTP(),
ExpiresAt: time.Now().Add(1 * time.Minute).Unix(),
})
return &model.AuthResponse{
Message: "Please check the OTP in your inbox",
ShouldShowOtpScreen: refs.NewBoolRef(true),