get_options();
if (isset($form['redeem-account'])){
//login
if ($plugin->login($form["email"], $form["password"])){
$url = $plugin->getURL("home");
$url = $plugin->getURL("home");
echo "
";
exit;
}else{
echo "";
showLoginForm($form["email"], $options->api_key);
}
}else if (isset($form['simply-add-code'])){
//save client ID
$plugin->set_api_key($form['api_key']);
$options = $plugin->get_options();
echo "";
exit;
}else{
$email = get_option('admin_email');
try {
$file = plugin_dir_path(__FILE__) . 'fortynuggets.key';
if (file_exists($file)){
$data = json_decode(file_get_contents($file));
$email = $data->email;
}
}catch(Exception $e) {}
showLoginForm($email, $options->api_key);
}
function showLoginForm($email, $api_key){
?>