Commit 777e51e5 authored by Erick Hitter's avatar Erick Hitter
Browse files

Accept both API keys, but only let the switch happen via a filter. Fixes #1.

parent 6ee12fa0
......@@ -36,7 +36,6 @@ class Authy_WP {
protected $api = null;
protected $api_key = null;
protected $api_endpoint = null;
protected $environment = 'production';
// Commong plugin elements
protected $settings_page = 'authy-for-wp';
......@@ -135,13 +134,13 @@ class Authy_WP {
'development' => 'http://sandbox-api.authy.com'
);
$this->environment = $this->get_setting( 'environment' );
$environment = $this->get_setting( 'environment' );
$api_key = $this->get_setting( 'api_key_' . $this->environment );
$api_key = $this->get_setting( 'api_key_' . $environment );
if ( $api_key && isset( $endpoints[ $this->environment ] ) ) {
if ( $api_key && isset( $endpoints[ $environment ] ) ) {
$this->api_key = $api_key;
$this->api_endpoint = $endpoints[ $this->environment ];
$this->api_endpoint = $endpoints[ $environment ];
}
$this->api = Authy_WP_API::instance( $this->api_key, $this->api_endpoint );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment