implement Email as username

This commit is contained in:
2024-09-24 16:56:14 -05:00
parent a7235941e7
commit 1b133edd78
11 changed files with 89 additions and 64 deletions

View File

@@ -10,7 +10,7 @@ import (
type User struct {
Id UserId
CustomerId CustomerId
Username Username
Email Email
EncipheredPasscode EncipheredNKode
Kp KeypadDimension
CipherKeys UserCipherKeys
@@ -117,7 +117,11 @@ func ValidKeyEntry(user User, customer Customer, selectedKeys []int) ([]int, err
return presumedAttrIdxVals, nil
}
func NewUser(customer Customer, username Username, passcodeIdx []int, ui UserInterface, kp KeypadDimension) (*User, error) {
func NewUser(customer Customer, userEmail string, passcodeIdx []int, ui UserInterface, kp KeypadDimension) (*User, error) {
_, err := ParseEmail(userEmail)
if err != nil {
return nil, err
}
setVals, err := customer.Attributes.SetValsForKp(kp)
if err != nil {
return nil, err
@@ -132,7 +136,7 @@ func NewUser(customer Customer, username Username, passcodeIdx []int, ui UserInt
}
newUser := User{
Id: UserId(uuid.New()),
Username: username,
Email: Email(userEmail),
EncipheredPasscode: *encipheredNKode,
CipherKeys: *newKeys,
Interface: ui,