-
Notifications
You must be signed in to change notification settings - Fork 53
silgy_usr_add_user
int silgy_usr_add_user(int ci, bool use_qs, const char *login, const char *email, const char *name, const char *passwd, const char *phone, const char *lang, const char *tz, const char *about, char group_id, char auth_level, char status)
Creates user account without using current session, typically when system admin adds user account. This function has two modes, depending on use_qs argument: If use_qs is true, it uses query string (or payload if POST), much like silgy_usr_create_account(). The rest of the arguments can be NULL. Otherwise it uses the arguments: login, email, name, passwd, phone, lang, tz, about. If passwd is NULL, then random, MIN_PASSWORD_LEN-long password will be generated.
ci is the connection index passed by the engine to silgy_app_main().
auth_level is the authorization level for the new user. See Sessions in Silgy for authorization levels table.
silgy_usr_xxx functions directly read the query string / payload data.
Request can contain the following parameters:
If no USERSBY... compilation switch is present or USERSBYLOGIN is present:
- login (mandatory)
- email (optionally)
If USERSBYEMAIL compilation switch is present:
- email (mandatory)
and also mandatory:
- passwd
- rpasswd
and optionally:
- name
- phone
- lang
- tz
- about
- message
Unless DONT_NOTIFY_NEW_USER is defined, and if email is present, new user will be notified about their new account and password.
Returns OK or one of the error codes:
- ERR_INVALID_REQUEST
- ERR_WEBSITE_FIRST_LETTER
- ERR_USERNAME_TOO_SHORT
- ERR_USERNAME_CHARS
- ERR_USERNAME_TAKEN
- ERR_EMAIL_FORMAT_OR_EMPTY
- ERR_PASSWORD_TOO_SHORT
- ERR_PASSWORD_DIFFERENT
- ERR_ROBOT
- ERR_INT_SERVER_ERROR
See silgy_app_main
function in silgy_app.cpp in Toy Facebook project.
Requires USERS compilation switch.