lwqzx_auth 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c89c3369d7214b42bcea9a1d00dc88be52bfad83
4
+ data.tar.gz: 59775c81b1d3f35f9cd0e0de5a976b622e594632
5
+ SHA512:
6
+ metadata.gz: d5a86dd5ab9df1725b461163e5161ca7287f494c25ad21fde9dcbcd89dca18d4f194c3dca6a2afc001dc3208960cc04ccce24b17f9253d90c0c2b817ba7d30de
7
+ data.tar.gz: 918609846c5c89aeca3a3bbba9a7601b5ad16d4447b213abfaa57c0e490b587bf283f85c9d1d57c7a94d014e9e8d833895af8a3e0a0e77d7fb31ad18f3bca908
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 zxy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # LwqzxAuth
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'lwqzx_auth'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install lwqzx_auth
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'LwqzxAuth'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ require 'bundler/gem_tasks'
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'test'
31
+ t.pattern = 'test/**/*_test.rb'
32
+ t.verbose = false
33
+ end
34
+
35
+
36
+ task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/lwqzx_auth .js
2
+ //= link_directory ../stylesheets/lwqzx_auth .css
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,6 @@
1
+ /*
2
+ *= require_tree .
3
+ *= require_self
4
+ */
5
+ @import "bootstrap-sprockets";
6
+ @import "bootstrap";
@@ -0,0 +1,5 @@
1
+ module LwqzxAuth
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,30 @@
1
+ require_dependency "lwqzx_auth/application_controller"
2
+
3
+ module LwqzxAuth
4
+ class AuthController < ::ApplicationController
5
+ def login
6
+ end
7
+
8
+ def logout
9
+ flash[:notice]="你已经登出"
10
+ reset_session
11
+ redirect_to main_app.root_path
12
+ end
13
+
14
+ def auth
15
+ login = params[:login]
16
+ psd = params[:password]
17
+ hsh = Lwqzx.auth(login,psd)
18
+ if hsh.blank?
19
+ redirect_to login_path , alert: "用户信息有误"
20
+ else
21
+ name = hsh[:name]
22
+ groups = hsh[:groups]
23
+ session[:login] = login
24
+ session[:realname] = name
25
+ session[:groups] = groups
26
+ redirect_to main_app.root_path and return
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ module LwqzxAuth
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LwqzxAuth
2
+ module AuthHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LwqzxAuth
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module LwqzxAuth
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module LwqzxAuth
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ h1 Auth#auth
2
+ p Find me in app/views/auth/auth.html.slim
@@ -0,0 +1,18 @@
1
+ h2.text-center =<> icon("user") + ' 登 录'
2
+ br
3
+ .row
4
+ .col-md-4
5
+ .col-md-4
6
+ = form_tag auth_path, role: "form", class: "panel panel-default form-horizontal" do
7
+ .panel-body
8
+ strong 登录名
9
+ br
10
+ = text_field_tag :login,nil,class: "form-control"
11
+ br
12
+ strong 密码:
13
+ br
14
+ = password_field_tag :password,nil, class: "form-control"
15
+
16
+
17
+ .panel-footer
18
+ = submit_tag '登录', class: "btn-block btn-primary btn"
@@ -0,0 +1,2 @@
1
+ h1 Auth#logout
2
+ p Find me in app/views/auth/logout.html.slim
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ LwqzxAuth::Engine.routes.draw do
2
+ get 'login' => "auth#login", as: :login
3
+ get 'logout' => "auth#logout", as: :logout
4
+ post 'auth' => "auth#auth", as: :auth
5
+ end
@@ -0,0 +1,5 @@
1
+ module LwqzxAuth
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace LwqzxAuth
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module LwqzxAuth
2
+ VERSION = '0.0.1'
3
+ end
data/lib/lwqzx_auth.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "lwqzx_auth/engine"
2
+
3
+ module LwqzxAuth
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :lwqzx_auth do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lwqzx_auth
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - zxy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: slim-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lwqzx
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bootstrap-sass
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: slim-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: auth function into host app.
84
+ email:
85
+ - zxy@qq.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - MIT-LICENSE
91
+ - README.md
92
+ - Rakefile
93
+ - app/assets/config/lwqzx_auth_manifest.js
94
+ - app/assets/javascripts/lwqzx_auth/application.js
95
+ - app/assets/stylesheets/lwqzx_auth/application.scss
96
+ - app/controllers/lwqzx_auth/application_controller.rb
97
+ - app/controllers/lwqzx_auth/auth_controller.rb
98
+ - app/helpers/lwqzx_auth/application_helper.rb
99
+ - app/helpers/lwqzx_auth/auth_helper.rb
100
+ - app/jobs/lwqzx_auth/application_job.rb
101
+ - app/mailers/lwqzx_auth/application_mailer.rb
102
+ - app/models/lwqzx_auth/application_record.rb
103
+ - app/views/lwqzx_auth/auth/auth.html.slim
104
+ - app/views/lwqzx_auth/auth/login.html.slim
105
+ - app/views/lwqzx_auth/auth/logout.html.slim
106
+ - config/routes.rb
107
+ - lib/lwqzx_auth.rb
108
+ - lib/lwqzx_auth/engine.rb
109
+ - lib/lwqzx_auth/version.rb
110
+ - lib/tasks/lwqzx_auth_tasks.rake
111
+ homepage: https://www.zapps.online
112
+ licenses:
113
+ - MIT
114
+ metadata: {}
115
+ post_install_message:
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 2.6.8
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: add auth function to host application.
135
+ test_files: []