Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # *********** Setting up scenarios ******************************
- # Each scenario has default settings. User can change all or some
- # of them. Each scenario Hash is merged with the default settings.
- #
- # :as_[scenario_name] values set the value to the corresponding value from
- # 'scenario_name'.
- @scenarios = {
- :sign_up => {
- :autologin => false,
- :set_cookies => :as_login,
- :captcha => true,
- :send_email => [:include_password, :use_activation],
- :on_fail => {:render => "#{@controller.to_s}/new", :flash => "Something is wrong!"},
- :on_success => {:redirect_to => :resource, :flash => "Your account has been created."}
- },
- :login => {
- :set_cookies => false, # remember_me token from params will force setting cookies anyway
- :captcha => true,
- :on_fail => {:render => "#{@controller.to_s}/login", :flash => "Login unsuccessful."},
- :on_success => {:redirect_to => :stored, :flash => "Login successful."}
- },
- :logout => {
- :remove_cookies => true,
- :on_fail => {:render => "/500.html"},
- :on_success => {:redirect_to => :stored, :flash => "Your account has been created."}
- },
- :change_password => {
- :logout => false,
- :ask_old_password => true, # forced false if changing password by recover token
- :set_cookies => :as_login, # only works if :logout is false
- :on_fail => {:render => "#{@controller.to_s}/change-password"},
- :on_success => {:redirect_to => :stored, :flash => "Your password has been changed."}
- },
- :recover_password => {
- :login => false,
- :on_fail => {
- :render => "#{@controller.to_s}/recover-password",
- :flash => "Your password token us invalid."
- },
- :on_success => {
- :redirect_to => "#{@controller.to_s}/change-password",
- :flash => "Now please change your password."
- }
- },
- :lost_password => {
- :on_fail => {
- :render => "#{@controller.to_s}/lost-password",
- :flash => "No such email was found in the database."
- },
- :on_success => {
- :render => "#{@controller.to_s}/lost-password",
- :flash => "Password recovery link was sent to you. Please check your email."
- }
- },
- :captcha => {
- :on_fail => {
- :render => :current,
- :flash => "Sorry, the letters you entered in CAPTCHA
- field don't match the ones on the picture, try again"
- }
- },
- :should_be_owner => {
- :on_fail => {:redirect_to => '/403.html'}
- }
- }
Add Comment
Please, Sign In to add comment