🐛 Bug fixes on multi-factors based authentication
This commit is contained in:
parent
6ea4850459
commit
68b4390edf
@ -4,12 +4,10 @@
|
||||
<option name="autoReloadType" value="ALL" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Allow user view and remove notification subscriptions">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":recycle: Improve notifications mark read system">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/models/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/notifications.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/notifications_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/notifications_api.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/accounts.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/accounts.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/cleaner.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/cleaner.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/models/auth.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/auth.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/ticket.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/ticket.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -156,7 +154,6 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value=":bug: Fix query issue" />
|
||||
<MESSAGE value=":bug: Fix compare perm node panic" />
|
||||
<MESSAGE value=":bug: Fix compare perm node function" />
|
||||
<MESSAGE value=":sparkles: Bot related bot key apis" />
|
||||
@ -181,7 +178,8 @@
|
||||
<MESSAGE value=":recycle: Single table to store auth preferences" />
|
||||
<MESSAGE value=":bug: Trying to prevent send same notification to the same user in batch" />
|
||||
<MESSAGE value=":sparkles: Allow user view and remove notification subscriptions" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Allow user view and remove notification subscriptions" />
|
||||
<MESSAGE value=":recycle: Improve notifications mark read system" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":recycle: Improve notifications mark read system" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
<settings-migrated>true</settings-migrated>
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type AuthConfig struct {
|
||||
MaximumAuthSteps int `json:"maximum_auth_steps" validate:"required,min=1"`
|
||||
MaximumAuthSteps int `json:"maximum_auth_steps"`
|
||||
}
|
||||
|
||||
type AuthFactorType = int8
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
|
||||
const InternalTokenAudience = "solar-network"
|
||||
|
||||
// DetectRisk is used for detect user environment is suitable for no multi-factor authenticate or not.
|
||||
// DetectRisk is used for detect user environment is suitable for no multifactorial authenticating or not.
|
||||
// Return the remaining steps, value is from 1 to 2, may appear 3 if user enabled the third-authentication-factor.
|
||||
func DetectRisk(user models.Account, ip, ua string) int {
|
||||
var clue int64
|
||||
@ -25,11 +25,11 @@ func DetectRisk(user models.Account, ip, ua string) int {
|
||||
Model(models.AuthTicket{}).
|
||||
Count(&clue).Error; err == nil {
|
||||
if clue >= 1 {
|
||||
return 1
|
||||
return 3
|
||||
}
|
||||
}
|
||||
|
||||
return 2
|
||||
return 3
|
||||
}
|
||||
|
||||
// PickTicketAttempt is trying to pick up the ticket that hasn't completed but created by a same client (identify by ip address).
|
||||
|
Loading…
Reference in New Issue
Block a user