| 
				
			 | 
			
			
				@@ -6,7 +6,7 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				6
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7
			 | 
			
				7
			 | 
			
			
				   def login 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				8
			 | 
			
			
				     if params[:session][:email].blank? || params[:session][:password].blank? 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				
			 | 
			
			
				-      flash[:warning] = "You forgot to add value" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				9
			 | 
			
			
				+      flash_message(:warning, "You forgot to add value") 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				10
			 | 
			
			
				       redirect_to action: 'login_form' 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				11
			 | 
			
			
				     else 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				12
			 | 
			
			
				       u = User.find_by(email: params[:session][:email]) 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -14,13 +14,13 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				14
			 | 
			
			
				       if u && u.confirmed && u.authenticate(params[:session][:password]) 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				15
			 | 
			
			
				         log_in(u, params[:session][:remember_me].to_i) 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				16
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				17
			 | 
			
				
			 | 
			
			
				-        flash[:success] = "Hello, #{u.person.full_name}!" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+        flash_message(:success, "Hello, #{u.person.full_name}!") 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				18
			 | 
			
			
				         redirect_to root_path 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				19
			 | 
			
			
				       elsif u and not u.confirmed 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				
			 | 
			
			
				-        flash[:warning] = "Your account has not been activated yet, please confirm using the email you have received." 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+        flash_message(:warning, "Your account has not been activated yet, please confirm using the email you have received.") 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				21
			 | 
			
			
				         redirect_to action: 'login_form' 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				22
			 | 
			
			
				       else 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				
			 | 
			
			
				-        flash[:danger] = "Invalid username/password combination!" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+        flash_message(:danger, "Invalid username/password combination!") 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				24
			 | 
			
			
				         redirect_to action: 'login_form' 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				25
			 | 
			
			
				       end 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				26
			 | 
			
			
				     end 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -47,14 +47,14 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				47
			 | 
			
				47
			 | 
			
			
				     person = Person.find_by(email: params[:user][:email]) 
			 | 
		
	
		
			
			| 
				48
			 | 
			
				48
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				49
			 | 
			
				49
			 | 
			
			
				     if not person 
			 | 
		
	
		
			
			| 
				50
			 | 
			
				
			 | 
			
			
				-      flash[:warning] = "That email address is unknown!" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+      flash_message(:warning, "That email address is unknown!") 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				51
			 | 
			
			
				       redirect_to action: 'create_password_form' 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				52
			 | 
			
			
				       return 
			 | 
		
	
		
			
			| 
				53
			 | 
			
				53
			 | 
			
			
				     end 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				54
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				55
			 | 
			
				55
			 | 
			
			
				     user = User.find_by(person: person) 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				56
			 | 
			
			
				     if user and user.confirmed 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				
			 | 
			
			
				-      flash[:warning] = "Your account has already been activated, please use the login form if you have forgotten your password." 
			 | 
		
	
		
			
			| 
				
			 | 
			
				57
			 | 
			
			
				+      flash_message(:warning, "Your account has already been activated, please use the login form if you have forgotten your password.") 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				58
			 | 
			
			
				       redirect_to action: 'login' 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				59
			 | 
			
			
				       return 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				60
			 | 
			
			
				     end 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -69,7 +69,7 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				69
			 | 
			
				69
			 | 
			
			
				     end 
			 | 
		
	
		
			
			| 
				70
			 | 
			
				70
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				71
			 | 
			
				71
			 | 
			
			
				     AuthenticationMailer::password_confirm_email(user).deliver_now 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				
			 | 
			
			
				-    flash[:success] = "An email has been sent, check your inbox!" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				72
			 | 
			
			
				+    flash_message(:success, "An email has been sent, check your inbox!") 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				73
			 | 
			
			
				     redirect_to action: 'login' 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				74
			 | 
			
			
				   end 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				75
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -80,12 +80,12 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				80
			 | 
			
			
				   def forgotten_password 
			 | 
		
	
		
			
			| 
				81
			 | 
			
				81
			 | 
			
			
				     user = User.find_by(email: params[:password_reset][:email]) 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				82
			 | 
			
			
				     if not user 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				
			 | 
			
			
				-      flash[:danger] = "That email address is not associated with any user." 
			 | 
		
	
		
			
			| 
				
			 | 
			
				83
			 | 
			
			
				+      flash_message(:danger, "That email address is not associated with any user.") 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				84
			 | 
			
			
				       redirect_to action: 'forgotten_password_form' 
			 | 
		
	
		
			
			| 
				85
			 | 
			
				85
			 | 
			
			
				       return 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				86
			 | 
			
			
				     end 
			 | 
		
	
		
			
			| 
				87
			 | 
			
				87
			 | 
			
			
				     AuthenticationMailer::password_reset_email(user).deliver_later 
			 | 
		
	
		
			
			| 
				88
			 | 
			
				
			 | 
			
			
				-    flash[:success] = "An email has been sent, check your inbox!" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				88
			 | 
			
			
				+    flash_message(:success, "An email has been sent, check your inbox!") 
			 | 
		
	
		
			
			| 
				89
			 | 
			
				89
			 | 
			
			
				     redirect_to action: 'login' 
			 | 
		
	
		
			
			| 
				90
			 | 
			
				90
			 | 
			
			
				   end 
			 | 
		
	
		
			
			| 
				91
			 | 
			
				91
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -104,7 +104,7 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				104
			 | 
			
				104
			 | 
			
			
				     end 
			 | 
		
	
		
			
			| 
				105
			 | 
			
				105
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				106
			 | 
			
				106
			 | 
			
			
				     if not params[:password] == params[:password_confirmation] 
			 | 
		
	
		
			
			| 
				107
			 | 
			
				
			 | 
			
			
				-      flash[:warning] = "Password confirmation does not match your password!" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				107
			 | 
			
			
				+      flash_message(:warning, "Password confirmation does not match your password!") 
			 | 
		
	
		
			
			| 
				108
			 | 
			
				108
			 | 
			
			
				       redirect_to action: 'reset_password_form', token: params[:token] 
			 | 
		
	
		
			
			| 
				109
			 | 
			
				109
			 | 
			
			
				       return 
			 | 
		
	
		
			
			| 
				110
			 | 
			
				110
			 | 
			
			
				     end 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -116,7 +116,7 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				116
			 | 
			
				116
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				117
			 | 
			
				117
			 | 
			
			
				     token.destroy! 
			 | 
		
	
		
			
			| 
				118
			 | 
			
				118
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				119
			 | 
			
				
			 | 
			
			
				-    flash[:success] = "Your password has been reset, you may now log in." 
			 | 
		
	
		
			
			| 
				
			 | 
			
				119
			 | 
			
			
				+    flash_message(:success, "Your password has been reset, you may now log in.") 
			 | 
		
	
		
			
			| 
				120
			 | 
			
				120
			 | 
			
			
				     redirect_to action: 'login' 
			 | 
		
	
		
			
			| 
				121
			 | 
			
				121
			 | 
			
			
				   end 
			 | 
		
	
		
			
			| 
				122
			 | 
			
				122
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -140,7 +140,7 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				140
			 | 
			
				140
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				141
			 | 
			
				141
			 | 
			
			
				     token.destroy! 
			 | 
		
	
		
			
			| 
				142
			 | 
			
				142
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				143
			 | 
			
				
			 | 
			
			
				-    flash[:success] = "Your account has been confirmed, you may now log in." 
			 | 
		
	
		
			
			| 
				
			 | 
			
				143
			 | 
			
			
				+    flash_message(:success, "Your account has been confirmed, you may now log in.") 
			 | 
		
	
		
			
			| 
				144
			 | 
			
				144
			 | 
			
			
				     redirect_to action: 'login' 
			 | 
		
	
		
			
			| 
				145
			 | 
			
				145
			 | 
			
			
				   end 
			 | 
		
	
		
			
			| 
				146
			 | 
			
				146
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -151,12 +151,12 @@ class AuthenticationController < ApplicationController 
			 | 
		
	
		
			
			| 
				151
			 | 
			
				151
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				152
			 | 
			
				152
			 | 
			
			
				   def token_valid?(token) 
			 | 
		
	
		
			
			| 
				153
			 | 
			
				153
			 | 
			
			
				     if token.nil? 
			 | 
		
	
		
			
			| 
				154
			 | 
			
				
			 | 
			
			
				-      flash[:warning] = "No valid token specified!" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				+      flash_message(:warning, "No valid token specified!") 
			 | 
		
	
		
			
			| 
				155
			 | 
			
				155
			 | 
			
			
				       redirect_to action: 'login' 
			 | 
		
	
		
			
			| 
				156
			 | 
			
				156
			 | 
			
			
				       return false 
			 | 
		
	
		
			
			| 
				157
			 | 
			
				157
			 | 
			
			
				     end 
			 | 
		
	
		
			
			| 
				158
			 | 
			
				158
			 | 
			
			
				     if token.expires and token.expires < DateTime.now 
			 | 
		
	
		
			
			| 
				159
			 | 
			
				
			 | 
			
			
				-      flash[:warning] = "That token has expired, please request a new one." 
			 | 
		
	
		
			
			| 
				
			 | 
			
				159
			 | 
			
			
				+      flash_message(:warning, "That token has expired, please request a new one.") 
			 | 
		
	
		
			
			| 
				160
			 | 
			
				160
			 | 
			
			
				       redirect_to action: 'login' 
			 | 
		
	
		
			
			| 
				161
			 | 
			
				161
			 | 
			
			
				       return false 
			 | 
		
	
		
			
			| 
				162
			 | 
			
				162
			 | 
			
			
				     end 
			 |