本文整理汇总了PHP中UserController::sendEmailOnVerify方法的典型用法代码示例。如果您正苦于以下问题:PHP UserController::sendEmailOnVerify方法的具体用法?PHP UserController::sendEmailOnVerify怎么用?PHP UserController::sendEmailOnVerify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserController
的用法示例。
在下文中一共展示了UserController::sendEmailOnVerify方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLogin
public function testLogin()
{
// Turn off sending email on usere creation
UserController::$sendEmailOnVerify = false;
// Create a user
$contestant = UserFactory::createUserWithoutVerify();
// Open index
$this->open('/');
// Click in Iniciar Sesion
$this->clickAndWait('link=Inicia sesion');
// Type login data
$this->type('user', $contestant->getUsername());
$this->type('pass', $contestant->getPassword());
// Click inicia sesion
$this->clickAndWait("//input[@value='Inicia sesion']");
// Wait for message
$this->waitForElementPresent('//*[@id="content"]/div[2]/div');
$this->assertElementContainsText('//*[@id="content"]/div[2]/div', 'Your email is not verified yet. Please check your e-mail.');
// Go to verification page and wait for redirection to login page
$this->open('/api/user/verifyemail/id/' . $contestant->getVerificationId());
$this->waitForElementPresent('//*[@id="content"]/div[2]/div[1]/h1');
// Type login data
$this->type('user', $contestant->getUsername());
$this->type('pass', $contestant->getPassword());
// Click inicia sesion
$this->clickAndWait("//input[@value='Inicia sesion']");
// Sanity check that we are logged in
$this->waitForElementPresent('//*[@id="wrapper"]/div[1]/a');
$this->assertElementContainsText('//*[@id="wrapper"]/div[1]/a', $contestant->getUsername());
}
示例2: login
/**
* Logs in a user an returns the auth_token
*
* @param Users $user
* @return string auth_token
*/
public static function login(Users $user)
{
UserController::$sendEmailOnVerify = false;
// Deactivate cookie setting
$oldCookieSetting = SessionController::$setCookieOnRegisterSession;
SessionController::$setCookieOnRegisterSession = false;
// Inflate request with user data
$r = new Request(array("usernameOrEmail" => $user->getUsername(), "password" => $user->getPassword()));
// Call the API
$response = UserController::apiLogin($r);
// Sanity check
self::assertEquals("ok", $response["status"]);
// Clean up leftovers of Login API
unset($_REQUEST);
// Set cookie setting as it was before the login
SessionController::$setCookieOnRegisterSession = $oldCookieSetting;
return $response["auth_token"];
}
示例3: testLogin
public function testLogin()
{
// Turn off sending email on usere creation
UserController::$sendEmailOnVerify = false;
// Create a user
$contestant = UserFactory::createUser();
// Open index
$this->open('/');
// Click in Iniciar Sesion
$this->clickAndWait('link=Inicia sesion');
// Type login data
$this->type('user', $contestant->getUsername());
$this->type('pass', $contestant->getPassword());
// Click inicia sesion
$this->clickAndWait("//input[@value='Inicia sesion']");
// Sanity check that we are logged in
$this->waitForElementPresent('//*[@id="wrapper"]/div[1]/a');
$this->assertElementContainsText('//*[@id="wrapper"]/div[1]/a', $contestant->getUsername());
}
示例4: omiPrepareUser
/**
* Resets the password of the OMI user and adds the user to the private
* contest.
* If the user does not exists, we create him.
*
* @param Request $r
* @param string $username
* @param string $password
*/
private static function omiPrepareUser(Request $r, $username, $password)
{
try {
$user = UsersDAO::FindByUsername($username);
} catch (Exception $e) {
throw new InvalidDatabaseOperationException($e);
}
if (is_null($user)) {
self::$log->info('Creating user: ' . $username);
$createRequest = new Request(array('username' => $username, 'password' => $password, 'email' => $username . '@omi.com', 'permission_key' => $r['permission_key']));
UserController::$sendEmailOnVerify = false;
self::apiCreate($createRequest);
return true;
} elseif (is_null($r['change_password']) || $r['change_password'] !== 'false') {
if (!$user->getVerified()) {
self::apiVerifyEmail(new Request(array('auth_token' => $r['auth_token'], 'usernameOrEmail' => $username)));
}
// Pwd changes are by default unless explictly disabled
$resetRequest = new Request();
$resetRequest['auth_token'] = $r['auth_token'];
$resetRequest['username'] = $username;
$resetRequest['password'] = $password;
$resetRequest['permission_key'] = $r['permission_key'];
self::apiChangePassword($resetRequest);
return true;
}
return false;
}
示例5: mkdir
require_once OMEGAUP_ROOT . "/tests/controllers/ApiCallerMock.php";
// Load test utils
require_once OMEGAUP_ROOT . "/tests/controllers/OmegaupTestCase.php";
require_once OMEGAUP_ROOT . "/tests/common/Utils.php";
// Load Factories
require_once OMEGAUP_ROOT . '/tests/factories/ProblemsFactory.php';
require_once OMEGAUP_ROOT . '/tests/factories/ContestsFactory.php';
require_once OMEGAUP_ROOT . '/tests/factories/ClarificationsFactory.php';
require_once OMEGAUP_ROOT . '/tests/factories/UserFactory.php';
require_once OMEGAUP_ROOT . '/tests/factories/RunsFactory.php';
require_once OMEGAUP_ROOT . '/tests/factories/GroupsFactory.php';
// Clean previous log
Utils::CleanLog();
// Clean problems and runs path
Utils::CleanPath(PROBLEMS_PATH);
Utils::CleanPath(PROBLEMS_GIT_PATH);
Utils::CleanPath(RUNS_PATH);
Utils::CleanPath(GRADE_PATH);
Utils::CleanPath(IMAGES_PATH);
for ($i = 0; $i < 256; $i++) {
mkdir(RUNS_PATH . sprintf('/%02x', $i), 0775, true);
mkdir(GRADE_PATH . sprintf('/%02x', $i), 0775, true);
}
// Clean DB
Utils::CleanupDB();
// Create a test default user for manual UI operations
UserController::$sendEmailOnVerify = false;
UserFactory::createUser("test", "testtesttest");
UserController::$sendEmailOnVerify = true;
// Globally disable run wait gap.
RunController::$defaultSubmissionGap = 0;
示例6: omiPrepareUser
/**
* Resets the password of the OMI user and adds the user to the private
* contest.
* If the user does not exists, we create him.
*
* @param Request $r
* @param string $username
* @param string $password
*/
private static function omiPrepareUser(Request $r, $username, $password)
{
try {
$user = UsersDAO::FindByUsername($username);
} catch (Exception $e) {
throw new InvalidDatabaseOperationException($e);
}
if (is_null($user)) {
self::$log->info("Creating user: " . $username);
$createRequest = new Request(array("username" => $username, "password" => $password, "email" => $username . "@omi.com", "permission_key" => $r['permission_key']));
UserController::$sendEmailOnVerify = false;
self::apiCreate($createRequest);
return true;
} else {
if (is_null($r["change_password"]) || $r["change_password"] !== "false") {
if (!$user->getVerified()) {
self::apiVerifyEmail(new Request(array("auth_token" => $r["auth_token"], "usernameOrEmail" => $username)));
}
// Pwd changes are by default unless explictly disabled
$resetRequest = new Request();
$resetRequest["auth_token"] = $r["auth_token"];
$resetRequest["username"] = $username;
$resetRequest["password"] = $password;
$resetRequest['permission_key'] = $r['permission_key'];
self::apiChangePassword($resetRequest);
return true;
}
}
return false;
}