[第十三只羊] 迷雾森林舞会VI devise登入

天亮了 昨晚是平安夜

关於迷雾森林故事

焦虑抑制剂

10号:哈罗大家好,我是海马诚实小君,其实原本一开始想说7号在预言家发言的时候她发言格式是比较蒙蒙懂懂的,当9号跳预言家的时候他是比较默认的感觉,所以目前我比较会站边9,8的话我同意9号玩家的说法,看他票型再决定

图片来源
1号:9好玩家的金水,好的,好像可以小喝一下金水,浅嚐,我也是觉得6号卦象重,她又有做笔记,所以牌应该很难记唷,非狼籍神,但是应该偏狼多,7号,再来7号跳起来的时候说他很紧张才说他是预言家,我觉得这有点不太像预言家的心态,然後刚刚夜晚的时间很久,我觉得可能会是狼人叫7号起跳,所以4号可能是恶灵,6号我觉得可以再听一局,毕竟他非狼即神,我也怕搞错,所以我觉得可能还是先出7吧

2号:7号啊7号,真是难以捉摸,因为他当好人的时候好狼,然後现在他跳预言家好像又是他一惯的风格,再来9号起跳,他的心路历程跟他的视角非常饱满。但是因为9号即使他是悍跳也可以毫不露出破绽,所以9号也没办法根据他的发言定义,因为他都会讲很好,但是如果要这样看的话可能要真的先站9号,因为他讲完也有带入7号的视角推测3 9视角 包狼的推测,感觉是好人视角在看全面,当9号发言的时候7号的表情很奇怪,所以我只能站9边,5跟我一样的视角跟反应,8号的话虽然有觉得7号是预言家,但也给了7号一点容忍度,站的比较中立在前置位发言,我觉得这局要先出7号,要先从预言家里面去放逐,好像只能出觉得确定的悍跳,6号我也是猜不透,再给他一轮表水

3号:我狼坑可能在2 6 7 8 出三只,四进三吧我觉得,4号被7发个金水他整个轻松到再喝蚵仔面线

4号:是笋仔汤啦

3号:开心到不行,轻松,9号比较饱满,然後7翻白眼好像感觉被抓到所以我会站9边,然後1号跟我看的的一样,就是6号看完身份牌马上记,有什麽一定要马上记得的,所以我目前坑是2 6 7 8 ,2虽然讲了很多但是要站边不站边,明明觉得9好,又觉得7捉摸不透所以得进坑。我站9边会出7号牌,过

待续

动物园派对

昨天 twitter社群登入有点问题
照做应该是不会...我感到很抱歉
但我还没修好,只好先补个email注册登入,twitter 那个有空再回头修
我们先再次修改routes

  devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks',
                                    registrations: 'users/registrations',
                                    sessions: 'users/sessions',
                                    passwords: 'users/passwords'}
  devise_scope :user do
    get '/users/sign_out' => 'devise/sessions#destroy'
  end

在 ApplicationController 补个 current_user

class ApplicationController < ActionController::Base
  def current_user
    @current_user = warden.authenticate(scope: :user)
  end
end

在controller资料夹下建立 users
并加入devise所需要的注册与登入controller
(也就是与OmniauthCallbacksController同一个资料夹)

/app/controllers/users/registrations_controller.rb
class Users::RegistrationsController < Devise::RegistrationsController
  before_action :configure_permitted_parameters, only: [:create]

  def new
    super
  end

  def create
      super do
        resource.save
      end
  end

  protected

  def configure_permitted_parameters
    devise_parameter_sanitizer.permit(
      :sign_up, keys: [
        :name, :email, :password,
        profile_attributes: %i[user_id mobile birthday news_letter_agreement]
      ]
    )
  end

  def after_update_path_for(resource)
    edit_user_path(resource)
  end
end


/app/controllers/users/sessions_controller.rb
class Users::SessionsController < Devise::SessionsController

  def new
    super
  end

  def create
    email = params[:user][:email]
    user = User.where(email: email).first

    if user.blank?
      redirect_to new_user_session_path, alert: '您的 email 或密码有误,请重新注册或登入'
      return
    end

    if user.present?
      super
    else
      flash[:notice] = I18n.t("devise.failure.unconfirmed_html").html_safe
      user.update(confirmation_sent_at: Time.zone.now - 3.months) if user.confirmation_sent_at.blank?
      user.resend_confirmation_instructions
      redirect_to new_user_session_path
    end
  end

  def destroy
    super
  end
end

回到RoomsController补上登入条件

class RoomsController < ApplicationController
  before_action :authenticate_user!, except: %i[index]
  before_action :set_room, only: %i[edit show destroy update]

  def index
    Room.all
  end
  ...

最後在application.html.erb的body中补上登入的元件

  <body>
    <div class="container">
      <p class="notice"><%= notice %></p>
      <p class="alert"><%= alert %></p>
      <%= yield %>
      <p class="navbar-text float-right">
        <% if user_signed_in? %>
          Logged in as <strong><%= current_user.email %></strong>.
          <%= link_to 'Edit profile', edit_user_registration_path, :class => 'navbar-link' %> |
          <%= link_to "Logout", destroy_user_session_path, method: :delete, :class => 'navbar-link'  %>
        <% else %>
          <%= link_to "Sign up", new_user_registration_path, :class => 'navbar-link'  %> |
          <%= link_to "Login", new_user_session_path, :class => 'navbar-link'  %>
        <% end %>
      </p>
    </div>
  </body>

这麽一来我们就可以登入/登出跟注册了

阿虎每日选币

https://ithelp.ithome.com.tw/upload/images/20210928/20131155D8nyeGWFqB.jpg

今天就用之财神爷来帮大家带财
https://opensea.io/collection/moneygod

天黑请闭眼


<<:  [DAY 13] 李家宇航牛肉汤

>>:  Day15_附录A.控制项(A.12运作安全)

【day1】豚花돈꽃韩式料理三访

在近三个月的防疫禁止内用期间 最想念的食物之一就是韩式烤肉了 (不用自己动手烤的那一种) 这家豚花돈...

D8 新增使用google account 登入的功能

前面做的那些都是让使用者直接在local端注册跟登入 今天处理一下怎麽做google登入 docsy...

30天零负担轻松学会制作APP介面及设计【DAY 18】

大家好,我是YIYI,今天我要来制做制做纪录月经的页面。 纪录经期 这边我把左上角的LIST换成返回...

Day 28 : 无线智慧装置

Wifi 开发板 现成的智慧装置搭配 HA 来控制让育儿变得更简单, 生活品质的提升也让你的人生更加...

08 C++演算法自学指南

昨天主要描述在心理层面应该要注意的事情,今天则是从实际层面上细数在自学并准备 APCS 时会碰到什麽...