lwqzx_auth 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4844e1d1a3e8a83a15621c958ce92b96511a43ad92d8e045a1da306551a2e820
4
- data.tar.gz: 6c84c127c17f024078c828117360dac596134830f243b149c68783178f7551ba
3
+ metadata.gz: 4413efd6d9a77135f2eccab4196b6ed2edcd61ce1aae003821dc19aeebe72588
4
+ data.tar.gz: f9c0c21a61e2b19314e4f3e6ecc1e39780c5dd32da24c40bdfbf7ed1920443ee
5
5
  SHA512:
6
- metadata.gz: 9ee179688a5e7a4a4dd23758a0027cac2be9c8ee2c74aab55b0e467a532c83f9f1a966c41cf8ef4a210651826f8636c9670bda8abef631a7c090b552b8e20e01
7
- data.tar.gz: a673bca9967b235d3d6dee0831ca262e614c1f5321ba9be82974852cada467732e2b86b6d7ab6d9e62086e83e8871f20fda2d01e9f833ff13664bdf1e39f5aa9
6
+ metadata.gz: 7e4addf6407cbadfc2a342779f8507cf578c912f96b91e6946de90e05497b69647906fe1c04b7f846929a7afb259818b854e10f31654b5f6cc9de72782ff814b
7
+ data.tar.gz: 6af0125425af9aa7bd72487ac08de3bc295f44a277f7c9f83d6a545eea3e9d700aaa5c6d2e95a02f95957709128b7745b7872cb6b4e02dea46b66a69c7d1d19b
@@ -12,6 +12,11 @@ module LwqzxAuth
12
12
  end
13
13
 
14
14
  def auth
15
+ unless verify_rucaptcha?
16
+ flash[:alert] = "验证码出错"
17
+ redirect_to main_app.root_path and return
18
+ end
19
+
15
20
  login = params[:login]
16
21
  psd = params[:password]
17
22
  hsh = lauth(login,psd)
@@ -3,7 +3,7 @@ br
3
3
  .row
4
4
  .col-sm-4
5
5
  .col-sm-4
6
- = form_tag auth_path, role: "form", class: "card form-horizontal" do
6
+ = form_tag auth_path, role: "form", class: "loginForm card form-horizontal" do
7
7
  .card-body
8
8
  strong 登录名
9
9
  br
@@ -12,8 +12,28 @@ br
12
12
  strong 密码:
13
13
  br
14
14
  = password_field_tag :password,nil, class: "form-control"
15
+ p.text-center
16
+ a.rucaptcha-image-box href="#" = rucaptcha_image_tag
17
+ p.text-center = rucaptcha_input_tag(class: 'form-control code',placeholder: "输入验证码")
15
18
 
16
19
  .card-footer
17
20
  = submit_tag '登录', class: "btn-block btn-primary btn"
18
21
 
19
22
  .col-sm-4
23
+
24
+ javascript:
25
+ javascript:
26
+ $(".loginForm").submit(function(event){
27
+ if($("input.code").val()==""){alert("请填写验证码");return false;};
28
+ if($("input.login").val()==""){alert("登录名不能为空");return false;};
29
+ if($("input.password").val()==""){alert("密码不能为空");return false;};
30
+ });
31
+
32
+ $("a.rucaptcha-image-box").click(function(e){
33
+ e.preventDefault();
34
+ btn = $(e.currentTarget);
35
+ img = btn.find('img:first');
36
+ currentSrc = img.attr('src');
37
+ img.attr('src', currentSrc.split('?')[0] + '?' + (new Date()).getTime());
38
+ return false;
39
+ });
@@ -0,0 +1,3 @@
1
+ RuCaptcha.configure do
2
+ self.cache_store = :mem_cache_store
3
+ end
@@ -1,3 +1,3 @@
1
1
  module LwqzxAuth
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lwqzx_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - zxy
@@ -30,6 +30,7 @@ files:
30
30
  - app/mailers/lwqzx_auth/application_mailer.rb
31
31
  - app/models/lwqzx_auth/application_record.rb
32
32
  - app/views/lwqzx_auth/auth/login.html.slim
33
+ - config/initializers/rucaptcha.rb
33
34
  - config/routes.rb
34
35
  - lib/lwqzx_auth.rb
35
36
  - lib/lwqzx_auth/engine.rb