MM-31063: Change constants to use CamelCase (#16608)
* MM-31063: Change constants to use CamelCase * store package * change allcaps to camel case (#16615) * New tools.mod Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8b6ac5f5d2
Коммит
c1dd23a3c8
@@ -18,7 +18,7 @@ import (
|
||||
|
||||
const (
|
||||
// This will result in 160 bits of entropy (base32 encoded), as recommended by rfc4226.
|
||||
MFA_SECRET_SIZE = 20
|
||||
MFASecretSize = 20
|
||||
)
|
||||
|
||||
type Mfa struct {
|
||||
@@ -58,7 +58,7 @@ func (m *Mfa) GenerateSecret(user *model.User) (string, []byte, *model.AppError)
|
||||
|
||||
issuer := getIssuerFromUrl(*m.ConfigService.Config().ServiceSettings.SiteURL)
|
||||
|
||||
secret := model.NewRandomBase32String(MFA_SECRET_SIZE)
|
||||
secret := model.NewRandomBase32String(MFASecretSize)
|
||||
|
||||
authLink := fmt.Sprintf("otpauth://totp/%s:%s?secret=%s&issuer=%s", issuer, user.Email, secret, issuer)
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ func TestGetIssuerFromUrl(t *testing.T) {
|
||||
|
||||
func TestActivate(t *testing.T) {
|
||||
user := &model.User{Id: model.NewId(), Roles: "system_user"}
|
||||
user.MfaSecret = model.NewRandomBase32String(MFA_SECRET_SIZE)
|
||||
user.MfaSecret = model.NewRandomBase32String(MFASecretSize)
|
||||
|
||||
token := dgoogauth.ComputeCode(user.MfaSecret, time.Now().UTC().Unix()/30)
|
||||
|
||||
@@ -226,7 +226,7 @@ func TestDeactivate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateToken(t *testing.T) {
|
||||
secret := model.NewRandomBase32String(MFA_SECRET_SIZE)
|
||||
secret := model.NewRandomBase32String(MFASecretSize)
|
||||
token := dgoogauth.ComputeCode(secret, time.Now().UTC().Unix()/30)
|
||||
|
||||
config := model.Config{}
|
||||
|
||||
Ссылка в новой задаче
Block a user