想在管理系统里加一个管理员登陆和退出,用户名和密码写死,要用页面的方式登录,卡在表单提交后的数据该怎么接收? app/views/users/index.html.erb如下:
<div class="form">
<form action="/sign_in" class="simple_form">
<h1>xxx<small>xxx</small></h1>
<div class="input string optional placeholder">
<label class="string optional" for="manager_username">名称</label>
<input autofocus="autofocus" class="string optional" id="manager_username" maxlength="30" name="manager[username]" size="30" type="text" value="" placeholder="名称">
</div>
<div class="input password optional placeholder">
<label class="password optional" for="manager_password">密码</label>
<input class="password optional" id="manager_password" maxlength="128" name="manager[password]" size="30" type="password" placeholder="密码">
</div>
<div class="links">
<div class="tr" style="text-align: left">
<a href="#">注册用户</a>
</div>
<div class="tr" style="text-align: right">
<a href="#">忘记密码?</a>
</div>
</div>
<div class="form-action submit">
<input type="submit" value="登录">
</div>
<div class="options">
<input type="checkbox" id="login">
<label for="login" class="auto_login">两周内自动登录</label>
</div>
</form>
</div>
routes.rb 如下
Rails.application.routes.draw do
resources :users
match '/sign_in', to: 'users#sign_in', via: 'get'
end
users_controller.rb 如下
class UsersController < ApplicationController
layout 'frontend_login_particle'
def index
end
def sign_in
end
end