diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-06-25 12:30:31 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-06-25 12:30:31 -0400 |
commit | 7e2e42379cb40a500eb8a236c05788eb3e84d141 (patch) | |
tree | 784dfe04f81b034889b96b5c251923da7e6f3a1e /app | |
parent | 275218aeaf24d4f9d58589cf68ec6647f0a65050 (diff) | |
download | thoughts-7e2e42379cb40a500eb8a236c05788eb3e84d141.tar.gz thoughts-7e2e42379cb40a500eb8a236c05788eb3e84d141.tar.bz2 thoughts-7e2e42379cb40a500eb8a236c05788eb3e84d141.zip |
Added logging in and logging out
Diffstat (limited to 'app')
25 files changed, 600 insertions, 4 deletions
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 40358bb..5ddb0bb 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | @import url('https://fonts.googleapis.com/css?family=Inconsolata'); | 18 | @import url('https://fonts.googleapis.com/css?family=Inconsolata'); |
19 | 19 | ||
20 | body { | 20 | body#main-body { |
21 | background-color: #bfefff; | 21 | background-color: #bfefff; |
22 | } | 22 | } |
23 | 23 | ||
@@ -76,3 +76,140 @@ body { | |||
76 | #sidebar h2 { | 76 | #sidebar h2 { |
77 | font-size: 1em; | 77 | font-size: 1em; |
78 | } | 78 | } |
79 | |||
80 | #flash { | ||
81 | width: 100%; | ||
82 | text-align: center; | ||
83 | padding: .25em; | ||
84 | font-weight: bold | ||
85 | } | ||
86 | |||
87 | .flash-notice { | ||
88 | background-color: #fffde8; | ||
89 | } | ||
90 | |||
91 | .flash-alert { | ||
92 | background-color: #ff6a6a; | ||
93 | } | ||
94 | |||
95 | html { | ||
96 | height: 100%; | ||
97 | } | ||
98 | |||
99 | body#userdata-body { | ||
100 | background-color: #eeeeee; | ||
101 | height: 100%; | ||
102 | } | ||
103 | |||
104 | #userdata-container { | ||
105 | margin: 4em auto 0; | ||
106 | width: 25%; | ||
107 | } | ||
108 | |||
109 | #userdata-form { | ||
110 | background-color: #fefefe; | ||
111 | -webkit-box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
112 | -moz-box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
113 | box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
114 | border-radius: 2px 2px 2px 2px; | ||
115 | -moz-border-radius: 2px 2px 2px 2px; | ||
116 | -webkit-border-radius: 2px 2px 2px 2px; | ||
117 | padding: 1em; | ||
118 | } | ||
119 | |||
120 | #userdata-form .field { | ||
121 | margin-bottom: 1em; | ||
122 | } | ||
123 | |||
124 | #userdata-form .field label { | ||
125 | display: block; | ||
126 | margin-bottom: .25em; | ||
127 | } | ||
128 | |||
129 | #userdata-form input[type=text], #userdata-form input[type=password] { | ||
130 | font-size: 24px; | ||
131 | padding: 3px; | ||
132 | width: 100%; | ||
133 | box-sizing: border-box; | ||
134 | -webkit-box-shadow: inset 0px 1px 2px 0px rgba(0,0,0,0.7); | ||
135 | -moz-box-shadow: inset 0px 1px 2px 0px rgba(0,0,0,0.7); | ||
136 | box-shadow: inset 0px 1px 2px 0px rgba(0,0,0,0.7); | ||
137 | border: 1px solid #ddd; | ||
138 | outline: 0; | ||
139 | border-radius: 0; | ||
140 | } | ||
141 | |||
142 | .remember-me-field { | ||
143 | float: left; | ||
144 | } | ||
145 | |||
146 | .submit-field { | ||
147 | text-align: right; | ||
148 | } | ||
149 | |||
150 | .userdata-link { | ||
151 | margin: 1em; | ||
152 | } | ||
153 | |||
154 | .userdata-link a { | ||
155 | text-decoration: none; | ||
156 | } | ||
157 | |||
158 | .userdata-link a:hover { | ||
159 | text-decoration: underline; | ||
160 | } | ||
161 | |||
162 | #userdata-form, .userdata-link a, .userdata-link a:visited { | ||
163 | color: #555d66; | ||
164 | } | ||
165 | |||
166 | #userdata-form label, .userdata-link a { | ||
167 | font-size: .75em; | ||
168 | } | ||
169 | |||
170 | #userdata-flash { | ||
171 | color: black; | ||
172 | background-color: white; | ||
173 | padding: .75em; | ||
174 | margin-bottom: 2em; | ||
175 | font-size: .8em; | ||
176 | -webkit-box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
177 | -moz-box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
178 | box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
179 | } | ||
180 | |||
181 | .userdata-flash-alert { | ||
182 | border-left: 5px solid red; | ||
183 | } | ||
184 | |||
185 | .userdata-flash-notice { | ||
186 | border-left: 5px solid green; | ||
187 | } | ||
188 | |||
189 | .userdata-flash-tag { | ||
190 | font-weight: bold; | ||
191 | } | ||
192 | |||
193 | .sidebar-module + .sidebar-module { | ||
194 | margin-top: 2em; | ||
195 | } | ||
196 | |||
197 | .sidebar-module ul { | ||
198 | padding-left: 0; | ||
199 | } | ||
200 | |||
201 | .sidebar-module li { | ||
202 | list-style-type: none; | ||
203 | } | ||
204 | |||
205 | .sidebar-module a { | ||
206 | text-decoration: none; | ||
207 | } | ||
208 | |||
209 | .sidebar-module a:hover { | ||
210 | text-decoration: underline; | ||
211 | } | ||
212 | |||
213 | .sidebar-module a:visited { | ||
214 | color: #352712; | ||
215 | } | ||
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1c07694..0174cae 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb | |||
@@ -1,3 +1,9 @@ | |||
1 | class ApplicationController < ActionController::Base | 1 | class ApplicationController < ActionController::Base |
2 | protect_from_forgery with: :exception | 2 | protect_from_forgery with: :exception |
3 | |||
4 | private | ||
5 | |||
6 | def after_sign_out_path_for(resource) | ||
7 | new_session_path(resource) | ||
8 | end | ||
3 | end | 9 | end |
diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb new file mode 100644 index 0000000..1126e23 --- /dev/null +++ b/app/controllers/users/confirmations_controller.rb | |||
@@ -0,0 +1,28 @@ | |||
1 | class Users::ConfirmationsController < Devise::ConfirmationsController | ||
2 | # GET /resource/confirmation/new | ||
3 | # def new | ||
4 | # super | ||
5 | # end | ||
6 | |||
7 | # POST /resource/confirmation | ||
8 | # def create | ||
9 | # super | ||
10 | # end | ||
11 | |||
12 | # GET /resource/confirmation?confirmation_token=abcdef | ||
13 | # def show | ||
14 | # super | ||
15 | # end | ||
16 | |||
17 | # protected | ||
18 | |||
19 | # The path used after resending confirmation instructions. | ||
20 | # def after_resending_confirmation_instructions_path_for(resource_name) | ||
21 | # super(resource_name) | ||
22 | # end | ||
23 | |||
24 | # The path used after confirmation. | ||
25 | # def after_confirmation_path_for(resource_name, resource) | ||
26 | # super(resource_name, resource) | ||
27 | # end | ||
28 | end | ||
diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb new file mode 100644 index 0000000..1907e5b --- /dev/null +++ b/app/controllers/users/omniauth_callbacks_controller.rb | |||
@@ -0,0 +1,28 @@ | |||
1 | class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | ||
2 | # You should configure your model like this: | ||
3 | # devise :omniauthable, omniauth_providers: [:twitter] | ||
4 | |||
5 | # You should also create an action method in this controller like this: | ||
6 | # def twitter | ||
7 | # end | ||
8 | |||
9 | # More info at: | ||
10 | # https://github.com/plataformatec/devise#omniauth | ||
11 | |||
12 | # GET|POST /resource/auth/twitter | ||
13 | # def passthru | ||
14 | # super | ||
15 | # end | ||
16 | |||
17 | # GET|POST /users/auth/twitter/callback | ||
18 | # def failure | ||
19 | # super | ||
20 | # end | ||
21 | |||
22 | # protected | ||
23 | |||
24 | # The path used when OmniAuth fails | ||
25 | # def after_omniauth_failure_path_for(scope) | ||
26 | # super(scope) | ||
27 | # end | ||
28 | end | ||
diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb new file mode 100644 index 0000000..53cc34e --- /dev/null +++ b/app/controllers/users/passwords_controller.rb | |||
@@ -0,0 +1,32 @@ | |||
1 | class Users::PasswordsController < Devise::PasswordsController | ||
2 | # GET /resource/password/new | ||
3 | # def new | ||
4 | # super | ||
5 | # end | ||
6 | |||
7 | # POST /resource/password | ||
8 | # def create | ||
9 | # super | ||
10 | # end | ||
11 | |||
12 | # GET /resource/password/edit?reset_password_token=abcdef | ||
13 | # def edit | ||
14 | # super | ||
15 | # end | ||
16 | |||
17 | # PUT /resource/password | ||
18 | # def update | ||
19 | # super | ||
20 | # end | ||
21 | |||
22 | # protected | ||
23 | |||
24 | # def after_resetting_password_path_for(resource) | ||
25 | # super(resource) | ||
26 | # end | ||
27 | |||
28 | # The path used after sending reset password instructions | ||
29 | # def after_sending_reset_password_instructions_path_for(resource_name) | ||
30 | # super(resource_name) | ||
31 | # end | ||
32 | end | ||
diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb new file mode 100644 index 0000000..4d6fbad --- /dev/null +++ b/app/controllers/users/registrations_controller.rb | |||
@@ -0,0 +1,60 @@ | |||
1 | class Users::RegistrationsController < Devise::RegistrationsController | ||
2 | # before_action :configure_sign_up_params, only: [:create] | ||
3 | # before_action :configure_account_update_params, only: [:update] | ||
4 | |||
5 | # GET /resource/sign_up | ||
6 | # def new | ||
7 | # super | ||
8 | # end | ||
9 | |||
10 | # POST /resource | ||
11 | # def create | ||
12 | # super | ||
13 | # end | ||
14 | |||
15 | # GET /resource/edit | ||
16 | # def edit | ||
17 | # super | ||
18 | # end | ||
19 | |||
20 | # PUT /resource | ||
21 | # def update | ||
22 | # super | ||
23 | # end | ||
24 | |||
25 | # DELETE /resource | ||
26 | # def destroy | ||
27 | # super | ||
28 | # end | ||
29 | |||
30 | # GET /resource/cancel | ||
31 | # Forces the session data which is usually expired after sign | ||
32 | # in to be expired now. This is useful if the user wants to | ||
33 | # cancel oauth signing in/up in the middle of the process, | ||
34 | # removing all OAuth session data. | ||
35 | # def cancel | ||
36 | # super | ||
37 | # end | ||
38 | |||
39 | # protected | ||
40 | |||
41 | # If you have extra params to permit, append them to the sanitizer. | ||
42 | # def configure_sign_up_params | ||
43 | # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute]) | ||
44 | # end | ||
45 | |||
46 | # If you have extra params to permit, append them to the sanitizer. | ||
47 | # def configure_account_update_params | ||
48 | # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute]) | ||
49 | # end | ||
50 | |||
51 | # The path used after sign up. | ||
52 | # def after_sign_up_path_for(resource) | ||
53 | # super(resource) | ||
54 | # end | ||
55 | |||
56 | # The path used after sign up for inactive accounts. | ||
57 | # def after_inactive_sign_up_path_for(resource) | ||
58 | # super(resource) | ||
59 | # end | ||
60 | end | ||
diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb new file mode 100644 index 0000000..889fba5 --- /dev/null +++ b/app/controllers/users/sessions_controller.rb | |||
@@ -0,0 +1,26 @@ | |||
1 | class Users::SessionsController < Devise::SessionsController | ||
2 | layout "userdata" | ||
3 | # before_action :configure_sign_in_params, only: [:create] | ||
4 | |||
5 | # GET /resource/sign_in | ||
6 | # def new | ||
7 | # super | ||
8 | # end | ||
9 | |||
10 | # POST /resource/sign_in | ||
11 | # def create | ||
12 | # super | ||
13 | # end | ||
14 | |||
15 | # DELETE /resource/sign_out | ||
16 | # def destroy | ||
17 | # super | ||
18 | # end | ||
19 | |||
20 | # protected | ||
21 | |||
22 | # If you have extra params to permit, append them to the sanitizer. | ||
23 | # def configure_sign_in_params | ||
24 | # devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute]) | ||
25 | # end | ||
26 | end | ||
diff --git a/app/controllers/users/unlocks_controller.rb b/app/controllers/users/unlocks_controller.rb new file mode 100644 index 0000000..8b9ef86 --- /dev/null +++ b/app/controllers/users/unlocks_controller.rb | |||
@@ -0,0 +1,28 @@ | |||
1 | class Users::UnlocksController < Devise::UnlocksController | ||
2 | # GET /resource/unlock/new | ||
3 | # def new | ||
4 | # super | ||
5 | # end | ||
6 | |||
7 | # POST /resource/unlock | ||
8 | # def create | ||
9 | # super | ||
10 | # end | ||
11 | |||
12 | # GET /resource/unlock?unlock_token=abcdef | ||
13 | # def show | ||
14 | # super | ||
15 | # end | ||
16 | |||
17 | # protected | ||
18 | |||
19 | # The path used after sending unlock password instructions | ||
20 | # def after_sending_unlock_instructions_path_for(resource) | ||
21 | # super(resource) | ||
22 | # end | ||
23 | |||
24 | # The path used after unlocking the resource | ||
25 | # def after_unlock_path_for(resource) | ||
26 | # super(resource) | ||
27 | # end | ||
28 | end | ||
diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..b8bdae1 --- /dev/null +++ b/app/models/user.rb | |||
@@ -0,0 +1,6 @@ | |||
1 | class User < ApplicationRecord | ||
2 | # Include default devise modules. Others available are: | ||
3 | # :confirmable, :lockable, :timeoutable and :omniauthable | ||
4 | devise :database_authenticatable, | ||
5 | :recoverable, :rememberable, :trackable, :validatable | ||
6 | end | ||
diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 0000000..2dc668f --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb | |||
@@ -0,0 +1,16 @@ | |||
1 | <h2>Resend confirmation instructions</h2> | ||
2 | |||
3 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> | ||
4 | <%= devise_error_messages! %> | ||
5 | |||
6 | <div class="field"> | ||
7 | <%= f.label :email %><br /> | ||
8 | <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> | ||
9 | </div> | ||
10 | |||
11 | <div class="actions"> | ||
12 | <%= f.submit "Resend confirmation instructions" %> | ||
13 | </div> | ||
14 | <% end %> | ||
15 | |||
16 | <%= render "devise/shared/links" %> | ||
diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..dc55f64 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb | |||
@@ -0,0 +1,5 @@ | |||
1 | <p>Welcome <%= @email %>!</p> | ||
2 | |||
3 | <p>You can confirm your account email through the link below:</p> | ||
4 | |||
5 | <p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p> | ||
diff --git a/app/views/devise/mailer/email_changed.html.erb b/app/views/devise/mailer/email_changed.html.erb new file mode 100644 index 0000000..32f4ba8 --- /dev/null +++ b/app/views/devise/mailer/email_changed.html.erb | |||
@@ -0,0 +1,7 @@ | |||
1 | <p>Hello <%= @email %>!</p> | ||
2 | |||
3 | <% if @resource.try(:unconfirmed_email?) %> | ||
4 | <p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p> | ||
5 | <% else %> | ||
6 | <p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p> | ||
7 | <% end %> | ||
diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb new file mode 100644 index 0000000..b41daf4 --- /dev/null +++ b/app/views/devise/mailer/password_change.html.erb | |||
@@ -0,0 +1,3 @@ | |||
1 | <p>Hello <%= @resource.email %>!</p> | ||
2 | |||
3 | <p>We're contacting you to notify you that your password has been changed.</p> | ||
diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..f667dc1 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb | |||
@@ -0,0 +1,8 @@ | |||
1 | <p>Hello <%= @resource.email %>!</p> | ||
2 | |||
3 | <p>Someone has requested a link to change your password. You can do this through the link below.</p> | ||
4 | |||
5 | <p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p> | ||
6 | |||
7 | <p>If you didn't request this, please ignore this email.</p> | ||
8 | <p>Your password won't change until you access the link above and create a new one.</p> | ||
diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb | |||
@@ -0,0 +1,7 @@ | |||
1 | <p>Hello <%= @resource.email %>!</p> | ||
2 | |||
3 | <p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p> | ||
4 | |||
5 | <p>Click the link below to unlock your account:</p> | ||
6 | |||
7 | <p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p> | ||
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..6a796b0 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb | |||
@@ -0,0 +1,25 @@ | |||
1 | <h2>Change your password</h2> | ||
2 | |||
3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> | ||
4 | <%= devise_error_messages! %> | ||
5 | <%= f.hidden_field :reset_password_token %> | ||
6 | |||
7 | <div class="field"> | ||
8 | <%= f.label :password, "New password" %><br /> | ||
9 | <% if @minimum_password_length %> | ||
10 | <em>(<%= @minimum_password_length %> characters minimum)</em><br /> | ||
11 | <% end %> | ||
12 | <%= f.password_field :password, autofocus: true, autocomplete: "off" %> | ||
13 | </div> | ||
14 | |||
15 | <div class="field"> | ||
16 | <%= f.label :password_confirmation, "Confirm new password" %><br /> | ||
17 | <%= f.password_field :password_confirmation, autocomplete: "off" %> | ||
18 | </div> | ||
19 | |||
20 | <div class="actions"> | ||
21 | <%= f.submit "Change my password" %> | ||
22 | </div> | ||
23 | <% end %> | ||
24 | |||
25 | <%= render "devise/shared/links" %> | ||
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 0000000..3d6d11a --- /dev/null +++ b/app/views/devise/passwords/new.html.erb | |||
@@ -0,0 +1,16 @@ | |||
1 | <h2>Forgot your password?</h2> | ||
2 | |||
3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> | ||
4 | <%= devise_error_messages! %> | ||
5 | |||
6 | <div class="field"> | ||
7 | <%= f.label :email %><br /> | ||
8 | <%= f.email_field :email, autofocus: true %> | ||
9 | </div> | ||
10 | |||
11 | <div class="actions"> | ||
12 | <%= f.submit "Send me reset password instructions" %> | ||
13 | </div> | ||
14 | <% end %> | ||
15 | |||
16 | <%= render "devise/shared/links" %> | ||
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 0000000..1e66f3d --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb | |||
@@ -0,0 +1,43 @@ | |||
1 | <h2>Edit <%= resource_name.to_s.humanize %></h2> | ||
2 | |||
3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> | ||
4 | <%= devise_error_messages! %> | ||
5 | |||
6 | <div class="field"> | ||
7 | <%= f.label :email %><br /> | ||
8 | <%= f.email_field :email, autofocus: true %> | ||
9 | </div> | ||
10 | |||
11 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> | ||
12 | <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div> | ||
13 | <% end %> | ||
14 | |||
15 | <div class="field"> | ||
16 | <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br /> | ||
17 | <%= f.password_field :password, autocomplete: "off" %> | ||
18 | <% if @minimum_password_length %> | ||
19 | <br /> | ||
20 | <em><%= @minimum_password_length %> characters minimum</em> | ||
21 | <% end %> | ||
22 | </div> | ||
23 | |||
24 | <div class="field"> | ||
25 | <%= f.label :password_confirmation %><br /> | ||
26 | <%= f.password_field :password_confirmation, autocomplete: "off" %> | ||
27 | </div> | ||
28 | |||
29 | <div class="field"> | ||
30 | <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br /> | ||
31 | <%= f.password_field :current_password, autocomplete: "off" %> | ||
32 | </div> | ||
33 | |||
34 | <div class="actions"> | ||
35 | <%= f.submit "Update" %> | ||
36 | </div> | ||
37 | <% end %> | ||
38 | |||
39 | <h3>Cancel my account</h3> | ||
40 | |||
41 | <p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p> | ||
42 | |||
43 | <%= link_to "Back", :back %> | ||
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 0000000..5a238ce --- /dev/null +++ b/app/views/devise/registrations/new.html.erb | |||
@@ -0,0 +1,29 @@ | |||
1 | <h2>Sign up</h2> | ||
2 | |||
3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> | ||
4 | <%= devise_error_messages! %> | ||
5 | |||
6 | <div class="field"> | ||
7 | <%= f.label :email %><br /> | ||
8 | <%= f.email_field :email, autofocus: true %> | ||
9 | </div> | ||
10 | |||
11 | <div class="field"> | ||
12 | <%= f.label :password %> | ||
13 | <% if @minimum_password_length %> | ||
14 | <em>(<%= @minimum_password_length %> characters minimum)</em> | ||
15 | <% end %><br /> | ||
16 | <%= f.password_field :password, autocomplete: "off" %> | ||
17 | </div> | ||
18 | |||
19 | <div class="field"> | ||
20 | <%= f.label :password_confirmation %><br /> | ||
21 | <%= f.password_field :password_confirmation, autocomplete: "off" %> | ||
22 | </div> | ||
23 | |||
24 | <div class="actions"> | ||
25 | <%= f.submit "Sign up" %> | ||
26 | </div> | ||
27 | <% end %> | ||
28 | |||
29 | <%= render "devise/shared/links" %> | ||
diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb new file mode 100644 index 0000000..e6a3e41 --- /dev/null +++ b/app/views/devise/shared/_links.html.erb | |||
@@ -0,0 +1,25 @@ | |||
1 | <%- if controller_name != 'sessions' %> | ||
2 | <%= link_to "Log in", new_session_path(resource_name) %><br /> | ||
3 | <% end -%> | ||
4 | |||
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> | ||
6 | <%= link_to "Sign up", new_registration_path(resource_name) %><br /> | ||
7 | <% end -%> | ||
8 | |||
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> | ||
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %><br /> | ||
11 | <% end -%> | ||
12 | |||
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> | ||
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br /> | ||
15 | <% end -%> | ||
16 | |||
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> | ||
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br /> | ||
19 | <% end -%> | ||
20 | |||
21 | <%- if devise_mapping.omniauthable? %> | ||
22 | <%- resource_class.omniauth_providers.each do |provider| %> | ||
23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br /> | ||
24 | <% end -%> | ||
25 | <% end -%> | ||
diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 0000000..16586bc --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb | |||
@@ -0,0 +1,16 @@ | |||
1 | <h2>Resend unlock instructions</h2> | ||
2 | |||
3 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> | ||
4 | <%= devise_error_messages! %> | ||
5 | |||
6 | <div class="field"> | ||
7 | <%= f.label :email %><br /> | ||
8 | <%= f.email_field :email, autofocus: true %> | ||
9 | </div> | ||
10 | |||
11 | <div class="actions"> | ||
12 | <%= f.submit "Resend unlock instructions" %> | ||
13 | </div> | ||
14 | <% end %> | ||
15 | |||
16 | <%= render "devise/shared/links" %> | ||
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 55d7805..e9d8dfd 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml | |||
@@ -5,12 +5,24 @@ | |||
5 | = csrf_meta_tags | 5 | = csrf_meta_tags |
6 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' | 6 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' |
7 | = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' | 7 | = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' |
8 | %body | 8 | %body#main-body |
9 | - if flash[:alert] | ||
10 | %div#flash.flash-alert= flash[:alert] | ||
11 | - if flash[:notice] | ||
12 | %div#flash.flash-notice= flash[:notice] | ||
9 | #container | 13 | #container |
10 | #banner | 14 | #banner |
11 | %h1= link_to "Thoughts", root_url | 15 | %h1= link_to "Thoughts", root_url |
12 | #main | 16 | #main |
13 | #content= yield | 17 | #content= yield |
14 | #sidebar | 18 | #sidebar |
15 | %h2 I'm Fef. | 19 | .sidebar-module |
16 | %p I'm a computer science undergrad at Carnegie Mellon University. I make a lot of things, including Twitter bots. I really like Pokémon, and I write about it a lot. | 20 | %h2 I'm Fef. |
21 | %p I'm a computer science undergrad at Carnegie Mellon University. I make a lot of things, including Twitter bots. I really like Pokémon, and I write about it a lot. | ||
22 | .sidebar-module | ||
23 | %h2 Meta | ||
24 | %ul | ||
25 | - if not user_signed_in? | ||
26 | %li= link_to "Log in", new_user_session_path | ||
27 | - if user_signed_in? | ||
28 | %li= link_to "Log out", destroy_user_session_path, method: :delete | ||
diff --git a/app/views/layouts/userdata.html.haml b/app/views/layouts/userdata.html.haml new file mode 100644 index 0000000..f6e3b57 --- /dev/null +++ b/app/views/layouts/userdata.html.haml | |||
@@ -0,0 +1,18 @@ | |||
1 | !!! 5 | ||
2 | %html | ||
3 | %head | ||
4 | %title Thoughts | ||
5 | = csrf_meta_tags | ||
6 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' | ||
7 | = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' | ||
8 | %body#userdata-body | ||
9 | #userdata-container | ||
10 | - if flash[:alert] | ||
11 | #userdata-flash.userdata-flash-alert | ||
12 | %span.userdata-flash-tag ERROR: | ||
13 | = flash.alert | ||
14 | - if flash[:notice] | ||
15 | #userdata-flash.userdata-flash-notice | ||
16 | %span.userdata-flash-tag NOTICE: | ||
17 | = flash.notice | ||
18 | = yield | ||
diff --git a/app/views/users/sessions/.new.html.haml.swo b/app/views/users/sessions/.new.html.haml.swo new file mode 100644 index 0000000..85950d9 --- /dev/null +++ b/app/views/users/sessions/.new.html.haml.swo | |||
Binary files differ | |||
diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml new file mode 100644 index 0000000..fbdf8be --- /dev/null +++ b/app/views/users/sessions/new.html.haml | |||
@@ -0,0 +1,15 @@ | |||
1 | #userdata-form | ||
2 | = form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| | ||
3 | .field | ||
4 | = f.label :login | ||
5 | = f.text_field :login, autofocus: true | ||
6 | .field | ||
7 | = f.label :password | ||
8 | = f.password_field :password, autocomplete: "off" | ||
9 | .remember-me-field | ||
10 | = f.check_box :remember_me | ||
11 | = f.label :remember_me | ||
12 | .submit-field | ||
13 | = f.submit "Log in" | ||
14 | .userdata-link= link_to "Forgot your password?", new_password_path(resource_name) | ||
15 | .userdata-link= link_to "← Back to thoughts", root_url | ||