mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
Cascade from the model/field deletes:
- FieldNamePassword + Record.SetPassword/SetRandomPassword/
ValidatePassword gone; record_model.go skips password fields when
deciding whether to refresh tokenKey on update; auth records no
longer carry a system password field
- Collection.initPasswordField + collection_validate's "needs system
password field" assertion gone — the auth-collection bootstrap is
now (id + tokenKey + email + emailVisibility + verified) only
- collectionAuthOptions trimmed: PasswordAuth, MFA, OTP, AuthAlert,
PasswordResetToken, ResetPasswordTemplate, OTPTemplate,
AuthAlertTemplate, AuthAlertConfig all removed. The remaining
surface is OAuth2 + AuthRule + ManageRule + Auth/EmailChange/
Verification/FileToken + verification/email-change templates
- Record.NewPasswordResetToken + TokenTypePasswordReset gone
- tests + import/serialization snapshots updated to match
- reservedAuthKeys ("passwordConfirm","oldPassword") gone; those
names are now ordinary user-defined field names if a caller wants
to use them
47 lines
1.6 KiB
Go
47 lines
1.6 KiB
Go
package core
|
|
|
|
// Email returns the "email" record field value (usually available with Auth collections).
|
|
func (m *Record) Email() string {
|
|
return m.GetString(FieldNameEmail)
|
|
}
|
|
|
|
// SetEmail sets the "email" record field value (usually available with Auth collections).
|
|
func (m *Record) SetEmail(email string) {
|
|
m.Set(FieldNameEmail, email)
|
|
}
|
|
|
|
// Verified returns the "emailVisibility" record field value (usually available with Auth collections).
|
|
func (m *Record) EmailVisibility() bool {
|
|
return m.GetBool(FieldNameEmailVisibility)
|
|
}
|
|
|
|
// SetEmailVisibility sets the "emailVisibility" record field value (usually available with Auth collections).
|
|
func (m *Record) SetEmailVisibility(visible bool) {
|
|
m.Set(FieldNameEmailVisibility, visible)
|
|
}
|
|
|
|
// Verified returns the "verified" record field value (usually available with Auth collections).
|
|
func (m *Record) Verified() bool {
|
|
return m.GetBool(FieldNameVerified)
|
|
}
|
|
|
|
// SetVerified sets the "verified" record field value (usually available with Auth collections).
|
|
func (m *Record) SetVerified(verified bool) {
|
|
m.Set(FieldNameVerified, verified)
|
|
}
|
|
|
|
// TokenKey returns the "tokenKey" record field value (usually available with Auth collections).
|
|
func (m *Record) TokenKey() string {
|
|
return m.GetString(FieldNameTokenKey)
|
|
}
|
|
|
|
// SetTokenKey sets the "tokenKey" record field value (usually available with Auth collections).
|
|
func (m *Record) SetTokenKey(key string) {
|
|
m.Set(FieldNameTokenKey, key)
|
|
}
|
|
|
|
// RefreshTokenKey generates and sets a new random auth record "tokenKey".
|
|
func (m *Record) RefreshTokenKey() {
|
|
m.Set(FieldNameTokenKey+autogenerateModifier, "")
|
|
}
|