mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 01:52:25 -05:00
check email + username availability
This commit is contained in:
parent
4982d7ffec
commit
88486b8447
1 changed files with 8 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ import (
|
||||||
"github.com/gotosocial/gotosocial/pkg/mastotypes"
|
"github.com/gotosocial/gotosocial/pkg/mastotypes"
|
||||||
)
|
)
|
||||||
|
|
||||||
func validateCreateAccount(form *mastotypes.AccountCreateRequest, reasonRequired bool, db db.DB) error {
|
func validateCreateAccount(form *mastotypes.AccountCreateRequest, reasonRequired bool, database db.DB) error {
|
||||||
if err := util.ValidateSignUpUsername(form.Username); err != nil {
|
if err := util.ValidateSignUpUsername(form.Username); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +51,13 @@ func validateCreateAccount(form *mastotypes.AccountCreateRequest, reasonRequired
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: validate new email address and new username
|
if err := database.IsEmailAvailable(form.Email); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := database.IsUsernameAvailable(form.Username); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue