taskrambler  0.1.8
Web server and task management solution.
_process_user_create_args.c File Reference
#include "hash.h"
#include "user.h"
#include "auth/credential.h"
#include "utils/memory.h"
#include "commons.h"
+ Include dependency graph for _process_user_create_args.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 

Functions

User _controllerGetUserFromArgs (Hash args)
 
Credential _controllerGetCredentialFromArgs (Hash args)
 
int _controllerProcessUserCreateArgs (Hash args, User *user, Credential *cred)
 

Detailed Description

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file _process_user_create_args.c.

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 23 of file _process_user_create_args.c.

Function Documentation

Credential _controllerGetCredentialFromArgs ( Hash  args)

Definition at line 34 of file _get_credential_from_args.c.

References _controllerValidatePasswordRepeat(), CRED_PASSWORD, CSTRA, FALSE, and hashGet().

Referenced by _controllerProcessUserCreateArgs().

35 {
36  HashValue email = hashGet(args, CSTRA("email"));
37  HashValue password = hashGet(args, CSTRA("password"));
38  HashValue pwrepeat = hashGet(args, CSTRA("pwrepeat"));
39 
40  if (
41  NULL == email ||
42  NULL == password ||
43  NULL == pwrepeat)
44  {
45  return FALSE;
46  }
47 
49  password->value,
50  password->nvalue,
51  pwrepeat->value,
52  pwrepeat->nvalue))
53  {
54  return FALSE;
55  }
56 
57  return new(Credential,
59  (char *)(email->value), email->nvalue,
60  (char *)(password->value), password->nvalue);
61 }
#define CSTRA(val)
Const STRing Argument.
Definition: memory.h:26
#define FALSE
Definition: commons.h:28
void * hashGet(Hash, const char *, size_t)
Definition: hash/get.c:51
int _controllerValidatePasswordRepeat(char *, size_t, char *, size_t)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

User _controllerGetUserFromArgs ( Hash  args)

Definition at line 33 of file _get_user_from_args.c.

References CSTRA, FALSE, and hashGet().

Referenced by _controllerProcessUserCreateArgs().

34 {
35  HashValue email = hashGet(args, CSTRA("email"));
36  HashValue firstname = hashGet(args, CSTRA("firstname"));
37  HashValue surname = hashGet(args, CSTRA("surname"));
38 
39  if (
40  NULL == email ||
41  NULL == firstname ||
42  NULL == surname)
43  {
44  return FALSE;
45  }
46 
47  return new(User,
48  (char *)(email->value), email->nvalue,
49  (char *)(email->value), email->nvalue,
50  (char *)(firstname->value), firstname->nvalue,
51  (char *)(surname->value), surname->nvalue);
52 }
#define CSTRA(val)
Const STRing Argument.
Definition: memory.h:26
#define FALSE
Definition: commons.h:28
void * hashGet(Hash, const char *, size_t)
Definition: hash/get.c:51

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int _controllerProcessUserCreateArgs ( Hash  args,
User *  user,
Credential *  cred 
)

Definition at line 36 of file _process_user_create_args.c.

References _controllerGetCredentialFromArgs(), _controllerGetUserFromArgs(), FALSE, and TRUE.

Referenced by controllerSignupCreate(), and controllerUserCreate().

37 {
38  *user = _controllerGetUserFromArgs(args);
40 
41  if (NULL == *user || NULL == *cred) {
42  delete(*user);
43  delete(*cred);
44 
45  return FALSE;
46  }
47 
48  return TRUE;
49 }
Credential _controllerGetCredentialFromArgs(Hash args)
#define FALSE
Definition: commons.h:28
#define TRUE
Definition: commons.h:27
User _controllerGetUserFromArgs(Hash args)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: