Devise - Confirming after the user edits email

后端 未结 3 2100
别跟我提以往
别跟我提以往 2021-02-07 14:17

I\'ve been trying to figure this out for 2 days. I\'m confirming user accounts with email confirmations (via Devise). I finally got all that working, but the whole point was to

3条回答
  •  悲哀的现实
    2021-02-07 15:03

    We had a similar issue (mainly because a confirmed user is not really an approved user in our system)- and decided to go with a user_status attribute. It has 2 statuses - "pending" which is confirmed but not yet approved, and "approved". If for some reason the user was no longer approved (in your case, they changed their email address), then we change them back to pending.

    We have a before_filter on the applicationController to verify where they should be going based on their status.

    def check_user_status
    if current_user #logged in
     case current_user.status
       when "pending" 
         redirect_to root_path #user hasn't been approved yet
       when "approved"
         #tracking logic here   
      end
     end
    end
    

    Hope this helps.

提交回复
热议问题