diff options
-rw-r--r-- | app/controllers/sessions_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index b58028a..784647c 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -29,8 +29,11 @@ class SessionsController < ApplicationController if new_ign.present? && new_ign != user.ign user.name = new_ign if user.ign == user.name user.ign = new_ign - user.save - flash[:notice] += " Your name has been changed to #{new_ign}!" + if (user.save rescue false) + flash[:notice] += " Your name has been changed to #{new_ign}!" + else + flash[:alert] = "Failed to save your new username #{new_ign}! Please contact admins." + end end flash[:alert] = "Remember to validate your email! Your account may be deleted soon!" if !user.confirmed? |