app/helpers/sessions_helper.rb in snapuser-0.2.2 vs app/helpers/sessions_helper.rb in snapuser-0.2.3

- old
+ new

@@ -1,9 +1,9 @@ module SessionsHelper # Sign in a user with a cookie (remove on browser close) - # + # # * *Args* : # - a user to sign in # * *Returns* : # def sign_in(user, permanent: false) @@ -14,20 +14,20 @@ def current_user=(user) @current_user = user end # Provid the user currently signed in. - # + # # * *Returns* : # - the user currently signed in def current_user @current_user ||= User.find_by_remember_token(cookies[:remember_token]) end # Check if there is a user signed in. - # + # # * *Returns* : # - true or false def signed_in? !current_user.nil? end @@ -37,21 +37,21 @@ self.current_user = nil cookies.delete(:remember_token) end # Store the current url in session's variable - # + # # * *Args* : - # + # # * *Returns* : # def store_location cookies[:return_to] = { value: request.fullpath, expires: 1.minute.from_now } end # Redirect the user to the stored url or the default one provided - # + # # * *Args* : # - default path to redirect to # * *Returns* : # def redirect_back_or(default, message = nil) @@ -72,6 +72,6 @@ def require_login redirect_to login_path, error: t("snapuser.errors.unconnected") unless signed_in? end -end \ No newline at end of file +end