refactor: manually renamed password fields
This commit is contained in:
@@ -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
|
||||
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,
|
||||
|
||||
@@ -76,11 +76,11 @@ WHERE users.username = $1;
|
||||
|
||||
;-- name: CreateLoginInformation :one
|
||||
INSERT INTO login_informations(user_id, email, password_hash)
|
||||
VALUES ( $1, $2, crypt($3, gen_salt('bf')) ) RETURNING *;
|
||||
VALUES ( $1, $2, crypt(@password::text, gen_salt('bf')) ) RETURNING *;
|
||||
|
||||
;-- 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(@password::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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user