AudioDidact\User
Class User stores user specific information
Synopsis
class User
{
- // members
- private $username;
- private $email;
- private $fname;
- private $lname;
- private $gender;
- private $webID;
- private $passwd;
- private $userID;
- private $feedText;
- private $feedLength;
- private $feedDetails;
- private bool $privateFeed;
- private bool $emailVerified;
- private $emailVerificationCodes;
- private $passwordRecoveryCodes;
- // methods
- public void __construct()
- public void signup()
- public bool validatePassword()
- public bool validateEmail()
- public bool validateWebID()
- public array addEmailVerificationCode()
- private array generateRandomCode()
- public bool verifyEmailVerificationCode()
- private bool verifyCodes()
- public array addPasswordRecoveryCode()
- public bool verifyPasswordRecoveryCode()
- public bool isEmailVerified()
- public void setEmailVerified()
- public array getEmailVerificationCodes()
- public void setEmailVerificationCodes()
- public array getPasswordRecoveryCodes()
- public void setPasswordRecoveryCodes()
- public bool validateName()
- public bool passwdCorrect()
- public mixed getPasswd()
- public void setPasswd()
- public mixed getUserID()
- public void setUserID()
- public mixed getUsername()
- public void setUsername()
- public mixed getEmail()
- public void setEmail()
- public mixed getFname()
- public void setFname()
- public mixed getLname()
- public void setLname()
- public int getGender()
- public void setGender()
- public mixed getWebID()
- public void setWebID()
- public void setPasswdDB()
- public string getFeedText()
- public void setFeedText()
- public int getFeedLength()
- public void setFeedLength()
- public array getFeedDetails()
- public void setFeedDetails()
- public boolean isPrivateFeed()
- public void setPrivateFeed()
Coverage
Methods | 95.45% | 42 / 44 |
Lines | 86.32% | 101 / 117 |
Members
private
- $email — string
- $emailVerificationCodes — array
- $emailVerified — AudioDidact\bool
- $feedDetails — array
- $feedLength — int
- $feedText — string
- $fname — string
- $gender — int
- $lname — string
- $passwd — string
- $passwordRecoveryCodes — array
- $privateFeed — AudioDidact\bool
- $userID — int
- $username — string
- $webID — string
Methods
private
- generateRandomCode() — returns a dictionary in the form of ["code"=random, "expiration"=24hours from now]
- verifyCodes() — Generic function to check that a given code is in a given code set and the expiration has not been exceeded
public
- __construct() — User constructor.
- addEmailVerificationCode() — Generates a random code and adds it to the list of email verification codes
- addPasswordRecoveryCode() — Generates a random code and adds it to the list of password recovery codes
- getEmail() — Gets email in lowercase
- getEmailVerificationCodes()
- getFeedDetails() — Gets the feed detail array
- getFeedLength() — Gets feed length
- getFeedText() — Gets feed text
- getFname() — Gets first name
- getGender() — Gets gender as integer, or if not set, returns 1 (Male)
- getLname() — Gets last name
- getPasswd() — Gets hashed password
- getPasswordRecoveryCodes()
- getUserID() — Gets user ID
- getUsername() — Gets username in lowercase
- getWebID() — Gets webID
- isEmailVerified()
- isPrivateFeed()
- passwdCorrect() — Checks if plaintext password when hashed, matches the hashed password stored in this User
- setEmail() — Sets email in lower case
- setEmailVerificationCodes()
- setEmailVerified()
- setFeedDetails() — Sets the feed detail array
- setFeedLength() — Sets feed length
- setFeedText() — Sets feed text
- setFname() — Sets first name
- setGender() — Sets gender
- setLname() — Sets last name
- setPasswd() — Sets hashed password using plaintext password and username
- setPasswdDB() — Used to set the hashed password from the database.
- setPasswordRecoveryCodes()
- setPrivateFeed()
- setUserID() — Sets user ID
- setUsername() — Sets username in lowercase
- setWebID() — Sets webID
- signup()
- validateEmail() — Validates names and other strings using PHP FILTER_VALIDATE_EMAIL. Returns true if the string is valid
- validateName() — Validates names and other strings using PHP FILTER_SANITIZE_STRING. Returns true if the string is valid
- validatePassword() — Validates password for length
- validateWebID() — Validates webID so it can only contain alphanumerics _,-,@, and $. Returns true if the string is valid
- verifyEmailVerificationCode() — verifies that a given email verification code is valid for this user
- verifyPasswordRecoveryCode() — verifies that a given password recovery code is valid for this user