+ def create
+ user = User.visible.find_by(:email => params[:email])
+
+ if user.nil?
+ users = User.visible.where("LOWER(email) = LOWER(?)", params[:email])
+
+ user = users.first if users.count == 1
+ end
+
+ if user
+ token = user.tokens.create
+ UserMailer.lost_password(user, token).deliver_later
+ flash[:notice] = t ".notice email on way"
+ redirect_to login_path
+ else
+ flash.now[:error] = t ".notice email cannot find"
+ render :new
+ end
+ end