billy_signup 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/images/billy_signup/accept.png +0 -0
- data/app/assets/images/billy_signup/am.png +0 -0
- data/app/assets/images/billy_signup/building.png +0 -0
- data/app/assets/images/billy_signup/coupon.png +0 -0
- data/app/assets/images/billy_signup/cross.png +0 -0
- data/app/assets/images/billy_signup/favicon.png +0 -0
- data/app/assets/images/billy_signup/keys.png +0 -0
- data/app/assets/images/billy_signup/link.png +0 -0
- data/app/assets/images/billy_signup/methods.png +0 -0
- data/app/assets/images/billy_signup/person.png +0 -0
- data/app/assets/images/billy_signup/sad.png +0 -0
- data/app/assets/images/billy_signup/tick.png +0 -0
- data/app/assets/javascripts/billy_signup/signup.js +78 -0
- data/app/assets/stylesheets/billy_signup/_signup.scss +185 -0
- data/app/assets/stylesheets/billy_signup/application.css +13 -0
- data/app/controllers/billy_signup/signups_controller.rb +127 -0
- data/app/helpers/billy_signup/signups_helper.rb +13 -0
- data/app/views/billy_signup/signups/_header.html.haml +3 -0
- data/app/views/billy_signup/signups/complete.html.haml +17 -0
- data/app/views/billy_signup/signups/new.html.haml +65 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +10 -0
- data/lib/billy_signup/engine.rb +5 -0
- data/lib/billy_signup/version.rb +3 -0
- data/lib/billy_signup.rb +4 -0
- data/lib/tasks/billy_signup_tasks.rake +4 -0
- data/test/billy_signup_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- metadata +224 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
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.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
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 = 'BillySignup'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
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
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,78 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
|
3
|
+
// auto load
|
4
|
+
if($('form input[name=email]').attr('value').length > 0) {
|
5
|
+
processSignupAuthCheck();
|
6
|
+
}
|
7
|
+
|
8
|
+
var formAuthCheckTimer;
|
9
|
+
$('form fieldset.creds input').keyup(function(e) {
|
10
|
+
if(e.which != 9 && e.which != 16 && e.which != 91 && e.which != 91) {
|
11
|
+
clearTimeout(formAuthCheckTimer);
|
12
|
+
formAuthCheckTimer = setTimeout(processSignupAuthCheck, 500);
|
13
|
+
}
|
14
|
+
});
|
15
|
+
|
16
|
+
$('form fieldset.creds input').change(function() {
|
17
|
+
clearTimeout(formAuthCheckTimer);
|
18
|
+
processSignupAuthCheck();
|
19
|
+
});
|
20
|
+
|
21
|
+
$('form p.exists a').on('click', function() {
|
22
|
+
$.ajax({
|
23
|
+
url: '/signup/reset_password',
|
24
|
+
type: 'post',
|
25
|
+
data: $('form').serialize(),
|
26
|
+
dataType:'json',
|
27
|
+
success: function(data) {
|
28
|
+
if(data.status == 'sent') {
|
29
|
+
$('p.exists').html('An email has been sent to <b>' + $('form input[name=email]').attr('value') + '</b> which contains a new password. You can copy this password into the password field above to continue your signup.');
|
30
|
+
} else {
|
31
|
+
alert('The address you entered could not be found. Please contact support if need further assistance.')
|
32
|
+
}
|
33
|
+
}
|
34
|
+
});
|
35
|
+
return false;
|
36
|
+
})
|
37
|
+
|
38
|
+
});
|
39
|
+
|
40
|
+
|
41
|
+
function processSignupAuthCheck() {
|
42
|
+
console.log("Processing auth check");
|
43
|
+
var form = $('form.signup');
|
44
|
+
$.ajax({
|
45
|
+
url: '/signup/validate_user',
|
46
|
+
type: 'post',
|
47
|
+
data: form.serialize(),
|
48
|
+
dataType:'json',
|
49
|
+
success: function(data) {
|
50
|
+
if(data.email_check.status == 'available') {
|
51
|
+
form.find('li.password p.label label').text('Choose a password');
|
52
|
+
form.find('p.exists').hide();
|
53
|
+
form.find('input[name=password]').removeClass('ok').removeClass('error');
|
54
|
+
form.find('input[name=first_name]').attr('disabled', false);
|
55
|
+
form.find('input[name=last_name]').attr('disabled', false);
|
56
|
+
} else {
|
57
|
+
form.find('li.password p.label label').text('Enter your password');
|
58
|
+
form.find('p.exists b').text(data.email_check.email);
|
59
|
+
|
60
|
+
if(data.authentication) {
|
61
|
+
if(data.authentication.status == 'valid') {
|
62
|
+
form.find('input[name=first_name]').attr('value', data.authentication.first_name).attr('disabled', true);
|
63
|
+
form.find('input[name=last_name]').attr('value', data.authentication.last_name).attr('disabled', true);
|
64
|
+
form.find('input[name=password]').addClass('ok').removeClass('error');
|
65
|
+
form.find('p.exists').hide('fast');
|
66
|
+
} else {
|
67
|
+
form.find('input[name=password]').removeClass('ok').addClass('error');
|
68
|
+
form.find('input[name=first_name]').attr('disabled', false);
|
69
|
+
form.find('input[name=last_name]').attr('disabled', false);
|
70
|
+
form.find('p.exists').show('fast');
|
71
|
+
}
|
72
|
+
} else {
|
73
|
+
form.find('p.exists').show('fast');
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
});
|
78
|
+
}
|
@@ -0,0 +1,185 @@
|
|
1
|
+
//
|
2
|
+
// Cloud Signup
|
3
|
+
//
|
4
|
+
section.signup {
|
5
|
+
div.area {
|
6
|
+
margin:auto;
|
7
|
+
margin-top:-15px;
|
8
|
+
margin-bottom:35px;
|
9
|
+
background:#fff;
|
10
|
+
width:75%;
|
11
|
+
overflow:hidden;
|
12
|
+
@include box-shadow(0,0,5px,rgba(0,0,0,0.3));
|
13
|
+
@include border-radius(6px);
|
14
|
+
.success {
|
15
|
+
padding:40px 60px;
|
16
|
+
text-align:center;
|
17
|
+
h2 { font-size:200%; }
|
18
|
+
p { margin:25px 0; font-size:120%; line-height:1.5;}
|
19
|
+
p a { color:#333;}
|
20
|
+
p.login { background:#f2f9ec;padding:25px 0; text-align:center; border:1px solid #cddbc2;}
|
21
|
+
p.login a { font-size:170%; letter-spacing:-1px; padding:10px 25px;}
|
22
|
+
}
|
23
|
+
|
24
|
+
.form {
|
25
|
+
padding:10px 0;
|
26
|
+
h2.intro { font-size:130%; font-weight:normal; color:#000; line-height:1.5; margin:15px 0; margin-bottom:0; margin-bottom:25px; padding-left:90px;}
|
27
|
+
h2.intro mark { background:#ffffde; font-weight:500;}
|
28
|
+
h2.intro.heading { font-weight:bold; font-size:160%;}
|
29
|
+
p.logo { margin-top:30px; padding-left:90px; }
|
30
|
+
p.trial { background:#ccc; position:absolute;margin-top:-0; color:#666; margin-left:700px; padding:5px; @include border-radius(50px); width:75px; height:75px; text-align:center; font-size:95%; font-weight:500; -webkit-transform:rotate(20deg); -moz-transform:rotate(20deg); line-height:1.1; text-transform:uppercase;}
|
31
|
+
p.trial b { font-size:130%; font-weight:900;display:block; margin-top:23px; margin-bottom:0; color:#000;}
|
32
|
+
p.text { font-size:120%; margin-left:90px; line-height:1.5; margin:25px 0; padding-left:90px; padding-right:35px;}
|
33
|
+
p.text mark { background:#ffffdd; font-weight:500}
|
34
|
+
p.text a { color:#000;}
|
35
|
+
p.text.link { margin-bottom:35px;}
|
36
|
+
p.text.link a { font-size:110%; padding:8px 15px; color:#fff;}
|
37
|
+
div.flash.alert {
|
38
|
+
border-bottom:1px solid #efefef;
|
39
|
+
color:red; font-weight:500; font-size:110%;
|
40
|
+
line-height:1.5;
|
41
|
+
padding:15px 60px 15px 90px;
|
42
|
+
background:url(../images/signup/sad.png) #fff9f9 no-repeat 35px 15px;
|
43
|
+
}
|
44
|
+
fieldset {
|
45
|
+
margin:0px 0;
|
46
|
+
border-top:1px solid #efefef;
|
47
|
+
padding:23px 35px;
|
48
|
+
padding-left:90px;
|
49
|
+
background:url(../images/signup/keys.png) no-repeat 35px 20px;
|
50
|
+
h3 { font-size:130%; font-weight:500; margin-bottom:15px; color:#111;}
|
51
|
+
ul {
|
52
|
+
height:70px;
|
53
|
+
li {
|
54
|
+
width:50%; float:left;
|
55
|
+
p.label { font-size:120%; color:#555; margin-bottom:10px;}
|
56
|
+
p.field input { font-size:170%; border:1px solid #e2e9eb; @include border-radius(4px); padding:8px; width:88%; background:#f8fafb;}
|
57
|
+
p.field input:focus {border-color:#b8d2db; @include box-shadow(0,0,8px,#c6dde5);}
|
58
|
+
p.field input.ok { background-image:url(../images/signup/tick.png); background-repeat:no-repeat; background-position:95% 10px;}
|
59
|
+
p.field input.error { background-image:url(../images/signup/cross.png); background-repeat:no-repeat; background-position:95% 10px;}
|
60
|
+
}
|
61
|
+
li.email { width:65%;}
|
62
|
+
li.password { width:35%;}
|
63
|
+
}
|
64
|
+
p.exists {
|
65
|
+
background:#ffffdd;
|
66
|
+
margin-top:15px;
|
67
|
+
padding:15px;
|
68
|
+
display:none;
|
69
|
+
font-size:110%;
|
70
|
+
line-height:1.5;
|
71
|
+
border:1px solid #ff8400;
|
72
|
+
a { color:#ff3c00;}
|
73
|
+
}
|
74
|
+
&.creds { border-top:0;}
|
75
|
+
&.name { background-image:url(../images/signup/person.png);}
|
76
|
+
&.account {
|
77
|
+
background-image:url(../images/signup/building.png);
|
78
|
+
ul { height:50px;}
|
79
|
+
}
|
80
|
+
&.coupon { background-image:url(../images/signup/coupon.png); display:none;}
|
81
|
+
&.submit {
|
82
|
+
background-image:url(../images/signup/accept.png);
|
83
|
+
p { font-size:110%; line-height:1.5; color:#666; margin-bottom:15px;}
|
84
|
+
p a { color:#666;}
|
85
|
+
p.submit { margin-top:25px;}
|
86
|
+
p.submit input { font-size:120%; padding:8px 15px;}
|
87
|
+
p.submit span { font-size:120%; margin-left:5px;}
|
88
|
+
p.coupon { float:right; font-size:90%;}
|
89
|
+
p.coupon a { color:#aaa;}
|
90
|
+
p.meta { margin-top:25px; font-size:90%; font-weight:1.5; color:#999;}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
//
|
99
|
+
// Purchases / old sign up process
|
100
|
+
//
|
101
|
+
|
102
|
+
section.page.about.signup .area .left-nav {
|
103
|
+
line-height:1.5;
|
104
|
+
width:250px;
|
105
|
+
h4 { font-weight:bold; margin-bottom:6px; font-size:110%;}
|
106
|
+
h4 b { background:#fffcc8;}
|
107
|
+
p { margin-bottom:10px;}
|
108
|
+
p a { text-decoration:underline;}
|
109
|
+
}
|
110
|
+
|
111
|
+
section.page.about.signup .area .content {
|
112
|
+
margin-left:260px;
|
113
|
+
|
114
|
+
p.button { margin-top:45px;}
|
115
|
+
p.button a { font-size:140%; padding:10px 18px;}
|
116
|
+
.errorExplanation {
|
117
|
+
color:red;
|
118
|
+
background:#ffe9e9;
|
119
|
+
margin:15px 0;
|
120
|
+
padding:12px;
|
121
|
+
line-height:1.8;
|
122
|
+
h2 { font-size:100%; text-shadow:0 0 0 #fff; letter-spacing:0; font-size:120%;}
|
123
|
+
ul li {list-style:square; margin-left:25px;}
|
124
|
+
p { display:none; }
|
125
|
+
}
|
126
|
+
|
127
|
+
p.already {
|
128
|
+
background:#FFFFFF;
|
129
|
+
color:#FF553A;
|
130
|
+
font-weight:bold;
|
131
|
+
font-size:100%;
|
132
|
+
border-left:0;
|
133
|
+
border-right:0;
|
134
|
+
border-left:5px solid #FF553A;
|
135
|
+
padding-left:11px;
|
136
|
+
font-size:100%;
|
137
|
+
margin-left:-16px;
|
138
|
+
a {
|
139
|
+
color:#FF553A;
|
140
|
+
font-weight:bold;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
|
145
|
+
p.existing-user {
|
146
|
+
background:#fffbea;
|
147
|
+
padding:15px;
|
148
|
+
font-size:120%;
|
149
|
+
line-height:1.5;
|
150
|
+
border:1px dashed #ffb400;
|
151
|
+
margin-top:5px;
|
152
|
+
}
|
153
|
+
fieldset.user { margin-top:5px;}
|
154
|
+
fieldset { border-top:1px solid #ccc;margin:25px 0;overflow:none; padding:15px 0; padding:10px; }
|
155
|
+
fieldset p { margin-bottom:15px; line-height:1.5; color:#999; font-size:110%;}
|
156
|
+
fieldset legend { font-size:140%; font-weight:bold;}
|
157
|
+
fieldset .col { width:48%; margin-right:2%;float:left;}
|
158
|
+
fieldset dl { margin-top:10px;}
|
159
|
+
fieldset dl dt { font-size:110%; color:#333; height:15px;}
|
160
|
+
fieldset dl dt label { font-weight:bold; color:#666; }
|
161
|
+
fieldset dl dd { margin:6px 0;height:35px;}
|
162
|
+
fieldset dl dd input.text { font-size:120%; width:288px; border:1px solid #ccc; padding:5px; border-right-color:#aaa; border-bottom-color:#aaa}
|
163
|
+
fieldset dl dd input.name { width:136px;}
|
164
|
+
fieldset dl dd.users b { font-weight:bold; margin-left:15px; font-size:120%; padding-top:2px; background:#333; color:#fff; padding:4px 5px; @include border-radius(3px); -moz-transform:rotate(3deg);-webkit-transform:rotate(3deg); display:inline-block; }
|
165
|
+
fieldset dl dd.users b span { font-weight:bold;}
|
166
|
+
fieldset.finish p { color:#333;}
|
167
|
+
fieldset.finish p a { color:#333;}
|
168
|
+
fieldset.options {
|
169
|
+
dl { width:50%; }
|
170
|
+
ul { float:right; width:50%; }
|
171
|
+
ul li { margin-bottom:10px;}
|
172
|
+
ul li input { float:left; margin-top:4px;}
|
173
|
+
ul li label { margin-left:25px;display:block; }
|
174
|
+
}
|
175
|
+
|
176
|
+
fieldset p.submit { text-align:center; }
|
177
|
+
fieldset p.submit input { font-size:110%; }
|
178
|
+
fieldset p.note { text-align:center; font-size:90%; color:#999; margin-bottom:0;}
|
179
|
+
fieldset p.note a { color:#999;}
|
180
|
+
fieldset.finish { background:#ebf6ff; padding:20px; border:1px dashed #5290c6; }
|
181
|
+
fieldset.finish p {margin-top:0; margin-bottom:15px;}
|
182
|
+
fieldset.finish p:last-child { margin-bottom:0;}
|
183
|
+
fieldset.finish legend { display:none;}
|
184
|
+
|
185
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,127 @@
|
|
1
|
+
class BillySignup::SignupsController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :only => [:new, :create] do
|
4
|
+
@product = Billy::Product.info
|
5
|
+
begin
|
6
|
+
@package = Billy::Package.find(params[:package]) if params[:package]
|
7
|
+
rescue Billy::Errors::NotFound
|
8
|
+
redirect_to :back, :alert => "Your selected package is not valid for #{@product.name}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def new
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
auth_hash = auth_details_hash
|
17
|
+
if auth_hash[:email_check] && auth_hash[:email_check][:status] == 'in-use'
|
18
|
+
## user exists
|
19
|
+
if auth_hash[:authentication] && auth_hash[:authentication][:status] == 'valid'
|
20
|
+
## logged in OK!
|
21
|
+
@identity = @auth.user
|
22
|
+
else
|
23
|
+
## password was invalid
|
24
|
+
flash.now[:alert] = "The password you have entered is not valid for the account associated with the email address you have entered. If you are unsure of your password, you can use the link below to request a new password."
|
25
|
+
render :action => "new"
|
26
|
+
return
|
27
|
+
end
|
28
|
+
else
|
29
|
+
temp_username = "#{params[:first_name].parameterize}-#{params[:last_name].parameterize}-#{rand(100)}"
|
30
|
+
hash = { :username => temp_username,
|
31
|
+
:password => params[:password],
|
32
|
+
:password_confirmation => params[:password],
|
33
|
+
:first_name => params[:first_name],
|
34
|
+
:last_name => params[:last_name],
|
35
|
+
:email_address => params[:email]
|
36
|
+
}
|
37
|
+
new_user = AtechIdentity::User.register(hash)
|
38
|
+
if new_user.is_a?(AtechIdentity::User)
|
39
|
+
@identity = new_user
|
40
|
+
else
|
41
|
+
flash.now[:alert] = "Sorry an error occured while registering your new admin account. Please check the details below and try again."
|
42
|
+
render :action => "new"
|
43
|
+
@ati_errors = new_user
|
44
|
+
return
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
## check the field have been entered
|
49
|
+
if params[:account_name].blank?
|
50
|
+
flash.now[:alert] = "You must enter a name for your account to use when accessing it in the form below"
|
51
|
+
render :action => "new"
|
52
|
+
return
|
53
|
+
end
|
54
|
+
|
55
|
+
## verify the domain
|
56
|
+
account_label = nil
|
57
|
+
account_label_index = 1
|
58
|
+
while account_label.nil?
|
59
|
+
proposed_domain = params[:account_name].gsub(/[^A-Za-z0-9\-\_\s]+/, '').parameterize
|
60
|
+
proposed_domain += account_label_index.to_s if account_label_index > 1
|
61
|
+
account_label = "#{proposed_domain}.#{@product.user_domain}"
|
62
|
+
errors = Billy::Service.validate_label(account_label)
|
63
|
+
if errors.is_a?(Array)
|
64
|
+
account_label = nil
|
65
|
+
account_label_index += 1
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
@service = Hash.new
|
70
|
+
@service[:billing_name] = params[:account_name]
|
71
|
+
@service[:label] = account_label
|
72
|
+
@service[:package] = @package.permalink
|
73
|
+
@service[:amount] = @package.amount
|
74
|
+
@service[:frequency] = @product.default_frequency || 1
|
75
|
+
@service[:trial_expires_on] = @product.trial_length.days.from_now.to_s(:db)
|
76
|
+
@service[:signup_source] = cookies[:referer]
|
77
|
+
|
78
|
+
if service = Billy::Service.create(@identity.identifier, @service)
|
79
|
+
session[:service_domain] = @service[:label]
|
80
|
+
session[:service_email] = params[:email]
|
81
|
+
redirect_to signup_complete_path
|
82
|
+
else
|
83
|
+
flash.now[:alert] = "An error occurred while creating your account. Please try again later or contact support."
|
84
|
+
render :action => "new"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def validate_user
|
89
|
+
render :json => auth_details_hash
|
90
|
+
end
|
91
|
+
|
92
|
+
def reset_password
|
93
|
+
user = AtechIdentity::User.find(params[:email])
|
94
|
+
if user && user.send_new_random_password
|
95
|
+
render :json => {:status => "sent"}
|
96
|
+
else
|
97
|
+
render :json => {:status => "failed"}
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
def auth_details_hash
|
104
|
+
hash = {}
|
105
|
+
if params[:email].include?('@')
|
106
|
+
if user = AtechIdentity::User.find(params[:email])
|
107
|
+
hash[:email_check] = {:status => 'in-use', :email => params[:email]}
|
108
|
+
else
|
109
|
+
hash[:email_check] = {:status => 'available'}
|
110
|
+
end
|
111
|
+
|
112
|
+
unless params[:password].blank?
|
113
|
+
@auth = AtechIdentity::Authentication.new(params[:email], params[:password])
|
114
|
+
if @auth.success?
|
115
|
+
hash[:authentication] = {:status => 'valid', :first_name => @auth.user.first_name, :last_name => @auth.user.last_name, :identifier => @auth.user.identifier}
|
116
|
+
else
|
117
|
+
hash[:authentication] = {:status => 'invalid'}
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
else
|
122
|
+
hash[:email_check] = {:status => 'available'}
|
123
|
+
end
|
124
|
+
hash
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module BillySignup
|
2
|
+
module SignupsHelper
|
3
|
+
|
4
|
+
def method_missing(method, *args, &block)
|
5
|
+
if (method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) && main_app.respond_to?(method)
|
6
|
+
main_app.send(method, *args)
|
7
|
+
else
|
8
|
+
super
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
- @page_title = 'Signup'
|
2
|
+
- @body_class = 'page'
|
3
|
+
- @active_nav = :signup
|
4
|
+
|
5
|
+
= render 'header'
|
6
|
+
%section.page.signup
|
7
|
+
%div.area
|
8
|
+
.success
|
9
|
+
%h2.intro.heading= t('.title_html')
|
10
|
+
%p.text= t('.subtitle_html')
|
11
|
+
|
12
|
+
%p.text= t('.login_info_html', :username => session[:service_email])
|
13
|
+
|
14
|
+
%p.login= link_to t('.login_button_html'), "#{Rails.env.development? ? 'http' : 'https'}://#{session[:service_domain]}?username=#{session[:service_email]}", :class => 'button green'
|
15
|
+
|
16
|
+
%p.text= t('.support_html')
|
17
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
- @page_title = 'Signup'
|
2
|
+
- @body_class = 'page'
|
3
|
+
- @active_nav = :signup
|
4
|
+
|
5
|
+
= content_for :head do
|
6
|
+
= javascript_include_tag 'signup'
|
7
|
+
|
8
|
+
= render 'header'
|
9
|
+
|
10
|
+
%section.page.signup
|
11
|
+
%div.area
|
12
|
+
.form
|
13
|
+
- if @package
|
14
|
+
%p.text
|
15
|
+
- if @package.amount > 0
|
16
|
+
= t('.package_description_html', :name => @package.name, :amount => number_to_currency(@package.amount))
|
17
|
+
- else
|
18
|
+
= t('.package_description_free_html', :name => @package.name)
|
19
|
+
|
20
|
+
= display_flash
|
21
|
+
= form_tag '', :class =>'signup' do
|
22
|
+
= hidden_field_tag 'token', params[:token]
|
23
|
+
= hidden_field_tag 'source', params[:source]
|
24
|
+
|
25
|
+
%fieldset.creds
|
26
|
+
%ul
|
27
|
+
%li.email
|
28
|
+
%p.label= label_tag 'email', "What's your e-mail address?"
|
29
|
+
%p.field= text_field_tag 'email', params[:email], :placeholder => "e.g. joe@example.com", :tabindex => 1, :class => 'focus'
|
30
|
+
%li.password
|
31
|
+
%p.label= label_tag 'password', "Choose a password"
|
32
|
+
%p.field= password_field_tag 'password', params[:password], :placeholder => "•••••••••••••", :tabindex => 2
|
33
|
+
|
34
|
+
%p.exists.partial
|
35
|
+
<b>Address</b> has an aTech Media account - this means you can just enter your password above and your new account
|
36
|
+
will be linked with your current credentials. If you are unsure of your password, just #{link_to 'click here'} and we'll send you a new one.
|
37
|
+
|
38
|
+
%fieldset.name
|
39
|
+
%ul
|
40
|
+
%li.first
|
41
|
+
%p.label= label_tag 'first_name', "What's your first name?"
|
42
|
+
%p.field= text_field_tag 'first_name', params[:first_name], :placeholder => 'e.g. Joe', :tabindex => 3
|
43
|
+
%li.last
|
44
|
+
%p.label= label_tag 'last_name', "...and your last name?"
|
45
|
+
%p.field= text_field_tag 'last_name', params[:last_name], :placeholder => 'e.g. Bloggs', :tabindex => 4
|
46
|
+
|
47
|
+
%fieldset.account
|
48
|
+
%ul
|
49
|
+
%li.email
|
50
|
+
%p.label= label_tag 'account_name', 'Enter a name for your new account'
|
51
|
+
%p.field= text_field_tag 'account_name', params[:account_name], :placeholder => "e.g. Acme Inc.", :tabindex => 5
|
52
|
+
|
53
|
+
%fieldset.submit
|
54
|
+
%h3 Complete your signup
|
55
|
+
%p
|
56
|
+
%b Once you have signed up you can downgrade, upgrade or cancel at any time.
|
57
|
+
By signing up for an account you agree to our
|
58
|
+
= link_to t('.terms_and_conditions'), @product.terms_url
|
59
|
+
and
|
60
|
+
= link_to t('.privacy_policy'), @product.privacy_url
|
61
|
+
|
62
|
+
%p.submit
|
63
|
+
= hidden_field_tag 'package', params[:package]
|
64
|
+
= submit_tag t('.submit_html'), :class => 'button green', :tabindex => 6
|
65
|
+
= text_field_tag 'check', '', :style => 'display:none;'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
en:
|
2
|
+
billy_signup:
|
3
|
+
signups:
|
4
|
+
header:
|
5
|
+
title: Signup Today
|
6
|
+
subtitle: We can have your new account up and running in just a few minutes, just fill out the form below.
|
7
|
+
|
8
|
+
new:
|
9
|
+
package_description_html: "You are signing up for the <mark>%{name}</mark> package which costs <mark>%{amount}/month</mark>."
|
10
|
+
package_description_free_html: "You are signing up for the <mark>%{name}</mark> package which is absolutely free."
|
11
|
+
terms_and_conditions: Terms and Conditions
|
12
|
+
privacy_policy: Privacy Policy
|
13
|
+
submit_html: "Create your new account →"
|
14
|
+
|
15
|
+
complete:
|
16
|
+
title_html: <b>Congratulations!</b> Your signup is complete!
|
17
|
+
subtitle_html:
|
18
|
+
"Your account is ready and waiting for you to start exploring.
|
19
|
+
When you login you'll be able to get started right away be following
|
20
|
+
the instructions on your welcome screen."
|
21
|
+
login_info_html: "You can login using %{username} and the password you just entered when you created the account."
|
22
|
+
login_button_html: "Go to your new Account →"
|
23
|
+
support_html: "If you have any questions, please don't hesitate to drop is a message or give us a call."
|
data/config/routes.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
BillySignup::Engine.routes.draw do
|
2
|
+
|
3
|
+
post 'validate_user' => 'signups#validate_user'
|
4
|
+
post 'reset_password' => 'signups#reset_password'
|
5
|
+
get 'complete' => 'signups#complete', :as => 'signup_complete'
|
6
|
+
get '(:package)' => 'signups#new', :as => 'signup'
|
7
|
+
post '(:package)' => 'signups#create'
|
8
|
+
|
9
|
+
|
10
|
+
end
|
data/lib/billy_signup.rb
ADDED