Compare commits
1 Commits
e8fdc75183
...
0643176ed1
Author | SHA1 | Date | |
---|---|---|---|
0643176ed1 |
@ -33,7 +33,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := db.CreateAdminUser(database, "admin"); err != nil {
|
if err := db.CreateAdminUser(database, "admin"); err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
go rushlink.StartMetricsServer(*metricsListen, database, filestore)
|
go rushlink.StartMetricsServer(*metricsListen, database, filestore)
|
||||||
|
@ -39,7 +39,7 @@ type FileUpload struct {
|
|||||||
PubID uuid.UUID `gorm:"uniqueIndex"`
|
PubID uuid.UUID `gorm:"uniqueIndex"`
|
||||||
|
|
||||||
// User ID that created this file
|
// User ID that created this file
|
||||||
CreatedBy uint `gorm:"index"`
|
CreatedBy uint `gorm:"index"`
|
||||||
|
|
||||||
// FileName contains the original filename of this FileUpload.
|
// FileName contains the original filename of this FileUpload.
|
||||||
FileName string
|
FileName string
|
||||||
|
@ -84,8 +84,8 @@ func HashPassword(password string) (string, error) {
|
|||||||
hash := argon2.IDKey([]byte(password), salt, 2, 64*1024, 1, pwdHashSize)
|
hash := argon2.IDKey([]byte(password), salt, 2, 64*1024, 1, pwdHashSize)
|
||||||
|
|
||||||
// Encode the salt and hash as a string in PHC format
|
// Encode the salt and hash as a string in PHC format
|
||||||
encodedSalt := base64.URLEncoding.EncodeToString(salt)
|
encodedSalt := base64.RawStdEncoding.EncodeToString(salt)
|
||||||
encodedHash := base64.URLEncoding.EncodeToString(hash)
|
encodedHash := base64.RawStdEncoding.EncodeToString(hash)
|
||||||
return fmt.Sprintf("$%s$%s$%s$%s", pwdAlgo, pwdParams, encodedSalt, encodedHash), nil
|
return fmt.Sprintf("$%s$%s$%s$%s", pwdAlgo, pwdParams, encodedSalt, encodedHash), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,11 +98,11 @@ func comparePassword(hashedPassword string, password string) (bool, error) {
|
|||||||
encodedSalt, encodedHash := fields[2], fields[3]
|
encodedSalt, encodedHash := fields[2], fields[3]
|
||||||
|
|
||||||
// Decode the salt and hash from base64
|
// Decode the salt and hash from base64
|
||||||
salt, err := base64.URLEncoding.DecodeString(encodedSalt)
|
salt, err := base64.RawStdEncoding.DecodeString(encodedSalt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
hash, err := base64.URLEncoding.DecodeString(encodedHash)
|
hash, err := base64.RawStdEncoding.DecodeString(encodedHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user