-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathhelp
151 lines (151 loc) · 6.29 KB
/
help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
[1mdiff --git a/app/controllers/pw_forgot_controller.rb b/app/controllers/pw_forgot_controller.rb[m
[1mdeleted file mode 100644[m
[1mindex d0eb69a..0000000[m
[1m--- a/app/controllers/pw_forgot_controller.rb[m
[1m+++ /dev/null[m
[36m@@ -1,5 +0,0 @@[m
[31m-class PwForgotController < ApplicationController[m
[31m- def index[m
[31m- end[m
[31m-end[m
[31m-[m
[1mdiff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb[m
[1mindex 8273963..a6888ff 100644[m
[1m--- a/app/mailers/user_mailer.rb[m
[1m+++ b/app/mailers/user_mailer.rb[m
[36m@@ -6,4 +6,10 @@[m [mclass UserMailer < ApplicationMailer[m
@url = 'http:/localhost:3000/login'[m
mail(to: @user.email, subject: 'Willkommen!')[m
end[m
[32m+[m
[32m+[m [32mdef reset_password_email(user)[m
[32m+[m [32m@user = User.find user.id[m
[32m+[m [32m@url = edit_password_reset_url(@user.reset_password_token)[m
[32m+[m [32mmail(:to => @user.email, :subject => "Ihr Passwort wurde zurückgesetzt")[m
[32m+[m [32mend[m
end[m
[1mdiff --git a/app/views/pw_forgot/index.html.erb b/app/views/pw_forgot/index.html.erb[m
[1mdeleted file mode 100644[m
[1mindex cc11f1d..0000000[m
[1m--- a/app/views/pw_forgot/index.html.erb[m
[1m+++ /dev/null[m
[36m@@ -1,13 +0,0 @@[m
[31m-<h1>Passwort vergessen</h1>[m
[31m-[m
[31m-<p id="notice"><%= notice %></p>[m
[31m-<%= form_tag do %>[m
[31m-<div class="field">[m
[31m- <%= label_tag :email, 'Bitte Emailadresse eingeben' %><br />[m
[31m- <%= text_field_tag :email %>[m
[31m- </div>[m
[31m-[m
[31m- <div class="actions">[m
[31m- <%= link_to 'Neues Passwort senden', :root , class: 'btn btn-success'%>[m
[31m- </div>[m
[31m-<% end %>[m
\ No newline at end of file[m
[1mdiff --git a/app/views/user_sessions/_form.html.erb b/app/views/user_sessions/_form.html.erb[m
[1mindex 76b8421..4b13d52 100644[m
[1m--- a/app/views/user_sessions/_form.html.erb[m
[1m+++ b/app/views/user_sessions/_form.html.erb[m
[36m@@ -11,7 +11,7 @@[m
<div class="actions" >[m
<div class="btn-group wider_btn_group">[m
<%= submit_tag "Login", class: "btn btn-success my_button1" %>[m
[31m- <%= link_to 'Passwort vergessen?', '/pw_forgot/index' , class: 'btn btn-warning my_button1'%>[m
[32m+[m[32m <%= link_to 'Passwort vergessen?', '/password_resets/index' , class: 'btn btn-warning my_button1'%>[m
</div>[m
</div>[m
<% end %>[m
[1mdiff --git a/config/environments/development.rb b/config/environments/development.rb[m
[1mindex 33790bd..a91624c 100644[m
[1m--- a/config/environments/development.rb[m
[1m+++ b/config/environments/development.rb[m
[36m@@ -24,7 +24,7 @@[m [mRails.application.configure do[m
config.action_mailer.perform_deliveries = true[m
config.action_mailer.raise_delivery_errors = true[m
config.action_mailer.default_options = {from: 'dbp2015studyproject@gmx.de'}[m
[31m-[m
[32m+[m[32m config.action_mailer.default_url_options = {:host => "localhost:3000"}[m
config.action_mailer.delivery_method = :smtp[m
config.action_mailer.smtp_settings = {[m
address: 'mail.gmx.net',[m
[1mdiff --git a/config/initializers/sorcery.rb b/config/initializers/sorcery.rb[m
[1mindex 7c6b537..7f5601a 100644[m
[1m--- a/config/initializers/sorcery.rb[m
[1m+++ b/config/initializers/sorcery.rb[m
[36m@@ -2,7 +2,7 @@[m
# The default is nothing which will include only core features (password encryption, login/logout).[m
# Available submodules are: :user_activation, :http_basic_auth, :remember_me,[m
# :reset_password, :session_timeout, :brute_force_protection, :activity_logging, :external[m
[31m-Rails.application.config.sorcery.submodules = [][m
[32m+[m[32mRails.application.config.sorcery.submodules = [:reset_password][m
[m
# Here you can configure each submodule's features.[m
Rails.application.config.sorcery.configure do |config|[m
[36m@@ -333,7 +333,7 @@[m [mRails.application.config.sorcery.configure do |config|[m
# mailer class. Needed.[m
# Default: `nil`[m
#[m
[31m- # user.reset_password_mailer =[m
[32m+[m[32m user.reset_password_mailer = UserMailer[m
[m
[m
# reset password email method on your mailer class.[m
[1mdiff --git a/config/routes.rb b/config/routes.rb[m
[1mindex a9c0f71..df0ced8 100644[m
[1m--- a/config/routes.rb[m
[1m+++ b/config/routes.rb[m
[36m@@ -2,7 +2,7 @@[m
[m
[m
Rails.application.routes.draw do[m
[31m- get 'pw_forgot/index'[m
[32m+[m[32m get 'password_resets/index'[m
[m
resources :courses[m
[m
[36m@@ -10,8 +10,8 @@[m [mRails.application.routes.draw do[m
resources :blocks[m
resources :user_sessions[m
resources :users [m
[32m+[m[32m resources :password_resets[m
root :to => 'home#home'[m
[31m- resources :pw_forgot[m
[m
[m
get 'login' => 'user_sessions#new', :as => :login[m
[1mdiff --git a/db/schema.rb b/db/schema.rb[m
[1mindex 2052e29..e87718b 100644[m
[1m--- a/db/schema.rb[m
[1m+++ b/db/schema.rb[m
[36m@@ -11,7 +11,7 @@[m
#[m
# It's strongly recommended that you check this file into your version control system.[m
[m
[31m-ActiveRecord::Schema.define(version: 20150902134630) do[m
[32m+[m[32mActiveRecord::Schema.define(version: 20150903084246) do[m
[m
# These are extensions that must be enabled in order to support this database[m
enable_extension "plpgsql"[m
[36m@@ -63,14 +63,18 @@[m [mActiveRecord::Schema.define(version: 20150902134630) do[m
end[m
[m
create_table "users", force: :cascade do |t|[m
[31m- t.string "email", null: false[m
[32m+[m[32m t.string "email", null: false[m
t.string "crypted_password"[m
t.string "salt"[m
t.datetime "created_at"[m
t.datetime "updated_at"[m
[31m- t.string "role"[m
[32m+[m[32m t.string "role", default: "student"[m
[32m+[m[32m t.string "reset_password_token"[m
[32m+[m[32m t.datetime "reset_password_token_expires_at"[m
[32m+[m[32m t.datetime "reset_password_email_sent_at"[m
end[m
[m
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree[m
[32m+[m[32m add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", using: :btree[m
[m
end[m