Update setting names, add README and LICENSE, add email scope

Update setting names, add README and LICENSE, add email scope

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e581291
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.DS_Store
+._.DS_Store
+/auto_generated
+/gems
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..4960d92
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2019 Civilized Discourse Construction Kit, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..17a249d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,22 @@
+# VK Authentication Plugin
+
+This plugin adds support for logging in to a Discourse site via VK.
+
+## How to Help
+
+- Create a PR with a new translation!
+- Log Issues
+- Submit PRs to help resolve issues
+
+## Installation
+
+1. Follow the directions at [Install a Plugin](https://meta.discourse.org/t/install-a-plugin/19157) using https://github.com/discourse/discourse-plugin-linkedin-auth.git as the repository URL.
+2. Rebuild the app using `./launcher rebuild app`
+3. Create a new application (or use existing one) at https://vk.com/apps?act=manage.
+4. Update the application settings and note the app ID and Secure key.
+5. In your Discourse instance, go to Site Settings, filter by "VK" and enter the app ID and the Secure key.
+6. Enable the plugin, and you're done!
+
+## Notes
+
+For issues and requests: https://meta.discourse.org/t/vk-com-login-vkontakte/12987
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 4744211..df4e8b4 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2,6 +2,6 @@
 
 en:
   site_settings:
-    vk_login_enabled: "Enable Login via Vkontakte"
-    vk_client_id: "Client id for VK authentication, registered at http://vk.com/"
-    vk_client_secret: "Client secret for VK authentication, registered at http://vk.com/"
+    vk_auth_enabled: "Enable Login via VK"
+    vk_app_id: "App ID for VK authentication, registered at https://vk.com"
+    vk_secure_key: "Secure key for VK authentication, registered at https://vk.com"
diff --git a/config/locales/server.ru.yml b/config/locales/server.ru.yml
index 6a54430..d6b0e8a 100644
--- a/config/locales/server.ru.yml
+++ b/config/locales/server.ru.yml
@@ -2,5 +2,5 @@
 
 ru:
   site_settings:
-    vk_client_id: "Client_id, зарегистрированный в http://vk.com/"
-    vk_client_secret: "Client_secret, зарегистрированный http://vk.com/"
+    vk_app_id: "App ID, зарегистрированный в https://vk.com/"
+    vk_secure_key: "Secure key, зарегистрированный https://vk.com/"
diff --git a/config/settings.yml b/config/settings.yml
index 5500cb5..0a43da9 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -1,8 +1,8 @@
 plugins:
-  vk_client_id:
+  vk_app_id:
     default: ""
-  vk_client_secret:
+  vk_secure_key:
     default: ""
-  vk_login_enabled:
+  vk_auth_enabled:
     client: true
     default: false
diff --git a/plugin.rb b/plugin.rb
index e2330b1..4d46f93 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -1,17 +1,15 @@
 # name: discourse-vk-auth
-# about: Authenticate with vk.com, see more at: https://vk.com/developers.php?id=-1_37230422&s=1
+# about: Authenticate with VK.com
 # version: 0.1
-# author: pmusaraj
+# author: Penar Musaraj
 # url: https://github.com/discourse/discourse-vk-auth
 
-enabled_site_setting :vk_login_enabled
-enabled_site_setting :vk_client_id
-enabled_site_setting :vk_client_secret
+enabled_site_setting :vk_auth_enabled
+enabled_site_setting :vk_app_id
+enabled_site_setting :vk_secure_key
 
 gem 'omniauth-vkontakte', '1.5.0'
 
-register_svg_icon "fab fa-vk" if respond_to?(:register_svg_icon)
-
 class Auth::VkontakteAuthenticator < Auth::ManagedAuthenticator
 
   def name
@@ -19,15 +17,16 @@ class Auth::VkontakteAuthenticator < Auth::ManagedAuthenticator
   end
 
   def enabled?
-    SiteSetting.vk_login_enabled
+    SiteSetting.vk_auth_enabled
   end
 
   def register_middleware(omniauth)
     omniauth.provider :vkontakte,
            setup: lambda { |env|
              strategy = env["omniauth.strategy"]
-              strategy.options[:client_id] = SiteSetting.vk_client_id
-              strategy.options[:client_secret] = SiteSetting.vk_client_secret
+              strategy.options[:client_id] = SiteSetting.vk_app_id
+              strategy.options[:client_secret] = SiteSetting.vk_secure_key
+              strategy.options[:scope] = 'email'
            }
   end
 
@@ -35,7 +34,7 @@ class Auth::VkontakteAuthenticator < Auth::ManagedAuthenticator
     info = UserAssociatedAccount.find_by(provider_name: name, user_id: user.id)&.info
     return "" if info.nil?
 
-    info["name"] || ""
+    info["name"] || info["email"] || ""
   end
 
   def after_authenticate(auth_token, existing_account: nil)
@@ -49,6 +48,8 @@ auth_provider frame_width: 920,
               frame_height: 800,
               authenticator: Auth::VkontakteAuthenticator.new
 
+register_svg_icon "fab fa-vk" if respond_to?(:register_svg_icon)
+
 register_css <<CSS
 .btn-social.vkontakte {
   background: #46698f;

GitHub sha: d1b966e545027b5c7f2f8ba7eb925ea7c3b0c5dc