`
CaiDeHen
  • 浏览: 96888 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

#21 Super Simple Authentication

阅读更多
The final piece of the administration puzzle: authentication. There are many different approaches which is why I saved this step for last. This episode will cover a few techniques including the simple solution used for this site.
# controllers/application.rb
def admin?
  session[:password] == 'foobar'
end

# sessions_controller.rb
def create
  session[:password] = params[:password]
  flash[:notice] = "Successfully logged in"
  redirect_to home_path
end

def destroy
  reset_session
  flash[:notice] = "Successfully logged out"
  redirect_to login_path
end

# config/routes.rb
map.resources :sessions, :episodes
map.home '', :controller => 'episodes', :action => 'index'
map.login 'login', :controller => 'sessions', :action => 'new'
map.logout 'logout', :controller => 'sessions', :action => 'destroy'
分享到:
评论

相关推荐

    华为交换机super命令

    1. 明文:`superpassword simple ****` 2. 加密:`super password cipher ****` 为了确保网络设备的安全,华为交换机还支持通过不同的访问方式对用户进行身份验证。对于三种常见的访问方式——console、telnet和web...

    华为路由交换设备常用命令.docx

    [HUAWEI]super password simple 123456 ``` ##### screen-length - **用途**:用于设置用户输入某一命令执行后终端屏幕每屏显示的行数。 - **示例**: ```shell <HUAWEI>screen-length 24 ``` ##### screen-...

    华为S950026-07-2006

    这意味着需要先使用 `set authentication password {cipher | simple} password` 命令配置口令后,登录才能成功。 - 当选择 `scheme` 时,进行本地或远端用户名和口令认证。具体是本地认证还是远端认证,则取决于...

    linux 下 带shell功能ftp源代码

    control it and fulfil files transferring at the same time , that is a simple combination for telnet and ftp server. Of course there are many fails and bugs in it , I'll appreciate the correction ...

    华为S3500交换机入门命令

    set authentication password {cipher | simple} password ``` **视图**:用户界面视图 **参数**: - `{cipher | simple}`:指定密码的加密方式,`cipher` 表示加密存储,`simple` 表示明文存储。 - `password`:...

    linux 下 结合ftp 和部分telnet 功能的服务器源码

    control it and fulfil files transferring at the same time , that is a simple combination for telnet and ftp server. Of course there are many fails and bugs in it , I'll appreciate the correction ...

    h3c交换机、路由器console和tel密码配置.pdf

    [H3C-ui-aux0]set authentication password simple 123456 ``` 完成配置后,当用户尝试通过Console端口登录时,系统会提示输入口令。 ### 二、命令控制级别的设置 用户可以通过命令控制级别来限制不同的操作权限...

    结合telnet与ftp 功能服务器wasd第三版源码

    this server and client programs is created for the s3c2410 platform board to conveniencely control it and fulfil files transferring at the same time , that is a simple combinationfor telnet and ftp ...

    华为命令收集大全.txt

    - `set authentication-mode password simple <password>`:设置简单密码,如`set authentication-mode password simple 222`。 - `user privilege level 3`:设置用户权限等级。 #### 显示当前配置 - `display ...

    h3c配置命令大全

    - **示例**: `[S3026-ui-vty0-4] set authentication-mode password simple 222` ##### 23. 设置VTY用户权限级别 - **命令**: `user privilege level <level>` - **功能**: 设置VTY用户的权限级别。 - **示例**...

    H3C交换机配置远程管理配置.docx

    - **配置Super Password**:使用命令`[SwitchA]super password level 3 simple super3`设置超级密码,以便低级别用户可以通过输入此密码提升权限。 ##### 6. TELNET RADIUS验证配置 - **配置RADIUS服务器**:以华为...

    H3C telnet的详细过程

    [Router]super password level 3 simple super [Router]user-interface con 0 [Router-ui-console0]user privilege level 1 [Router-ui-console0]set authentication password simple abc ``` 对于需要使用用户名和...

    如何配置H3C交换机

    [H3C-ui-console0]set authentication password simple h3c ``` 其中,`console 0`指的是通过Console线连接的端口。 #### 5. 用户的命令控制级别设置 通过命令控制级别设置,管理员可以限制不同用户的权限。例如,...

    YT-Django-Simple-Blog-App-Part8-User-Authentication-System

    这个项目名为"YT-Django-Simple-Blog-App-Part8-User-Authentication-System",它涵盖了Web开发中的关键安全功能——用户登录、注册和权限管理。 首先,Django内置了强大的用户认证系统,允许开发者轻松地实现用户...

    H3C恢复资料文档

    - 设置口令:`set authentication password simple h3c`。 - 设置命令控制级别:`user privilege level 0`。 - 设置超级用户密码:`super password level 1 simple 111111`等。 8. **配置TELNET密码验证** - ...

    51CTO下载-华为S2300命令整理

    - **命令**:`super password <level> { simple | cipher } <password>` - **功能说明**:配置超级密码,用于限制访问级别较高的用户界面。 #### 十六、接口状态查询 - **命令**:`display interface` - **功能说明...

    H3C 交换机命令

    [S3026-ui-vty0-4]set authentication-mode password simple 222 ``` 设置VTY接口的登录密码为“222”。 - **设置用户权限等级** ``` [S3026-ui-vty0-4]user privilege level 3 ``` 设置用户权限等级为3级,...

    华为交换机基本配置,华为交换机的基本命令操作

    3. **设置密码**:`[S3026-ui-vty0-4] set authentication-mode password simple 222` 4. **设置用户权限级别**:`[S3026-ui-vty0-4] user privilege level 3` #### 八、配置端口属性 在接口视图下,还可以配置端口...

    华为交换机配置大家快来看看

    - `set authentication-mode password simple 222`设置VTY接口的登录密码为222。 - `user privilege level 3`设置用户权限等级,数字越高,权限越大。本例中设置为3级。 ### 5. 配置RADIUS服务器 - `radiusscheme ...

Global site tag (gtag.js) - Google Analytics