refactor: manually renamed password fields

This commit is contained in:
2025-06-19 17:16:41 +03:00
parent 49534d46c1
commit 912470b6e2
2 changed files with 10 additions and 10 deletions

View File

@@ -78,17 +78,17 @@ func (q *Queries) CreateConfirmationCode(ctx context.Context, arg CreateConfirma
const createLoginInformation = `-- name: CreateLoginInformation :one
INSERT INTO login_informations(user_id, email, password_hash)
VALUES ( $1, $2, crypt($3, gen_salt('bf')) ) RETURNING id, user_id, email, password_hash, totp_encrypted, email_2fa_enabled, password_change_date
VALUES ( $1, $2, crypt($3::text, gen_salt('bf')) ) RETURNING id, user_id, email, password_hash, totp_encrypted, email_2fa_enabled, password_change_date
`
type CreateLoginInformationParams struct {
UserID int64
Email pgtype.Text
Crypt string
UserID int64
Email pgtype.Text
Password string
}
func (q *Queries) CreateLoginInformation(ctx context.Context, arg CreateLoginInformationParams) (LoginInformation, error) {
row := q.db.QueryRow(ctx, createLoginInformation, arg.UserID, arg.Email, arg.Crypt)
row := q.db.QueryRow(ctx, createLoginInformation, arg.UserID, arg.Email, arg.Password)
var i LoginInformation
err := row.Scan(
&i.ID,
@@ -692,7 +692,7 @@ func (q *Queries) UpdateConfirmationCode(ctx context.Context, arg UpdateConfirma
const updateLoginInformationByUsername = `-- name: UpdateLoginInformationByUsername :exec
UPDATE login_informations
SET email = $2, password_hash = crypt($3, gen_salt('bf')), totp_encrypted = $4, email_2fa_enabled = $5, password_change_date = $6
SET email = $2, password_hash = crypt($3::text, gen_salt('bf')), totp_encrypted = $4, email_2fa_enabled = $5, password_change_date = $6
FROM users
WHERE users.username = $1 AND login_informations.user_id = users.id
`
@@ -700,7 +700,7 @@ WHERE users.username = $1 AND login_informations.user_id = users.id
type UpdateLoginInformationByUsernameParams struct {
Username string
Email pgtype.Text
Crypt string
Password string
TotpEncrypted pgtype.Text
Email2faEnabled pgtype.Bool
PasswordChangeDate pgtype.Timestamp
@@ -710,7 +710,7 @@ func (q *Queries) UpdateLoginInformationByUsername(ctx context.Context, arg Upda
_, err := q.db.Exec(ctx, updateLoginInformationByUsername,
arg.Username,
arg.Email,
arg.Crypt,
arg.Password,
arg.TotpEncrypted,
arg.Email2faEnabled,
arg.PasswordChangeDate,