Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Devise - taking care of your users
Search
Andreas Bjärlestam
February 22, 2011
Technology
0
74
Devise - taking care of your users
A quick intro to the Devise, the signup module for Ruby on Rails
Andreas Bjärlestam
February 22, 2011
Tweet
Share
More Decks by Andreas Bjärlestam
See All by Andreas Bjärlestam
Climate compensate with a pull request
bjarlestam
0
35
Agile performance testing
bjarlestam
0
110
SPDY and HTTP2
bjarlestam
1
1.2k
SPDY or maybe HTTP2.0
bjarlestam
4
65
jquery mobile
bjarlestam
0
72
REST with JAX-RS
bjarlestam
1
92
REST
bjarlestam
2
170
Other Decks in Technology
See All in Technology
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
5.6k
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
180
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
AIエージェントに必要なのはデータではなく文脈だった/ai-agent-context-graph-mybest
jonnojun
0
180
Bill One急成長の舞台裏 開発組織が直面した失敗と教訓
sansantech
PRO
2
380
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.6k
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
1
380
コミュニティが変えるキャリアの地平線:コロナ禍新卒入社のエンジニアがAWSコミュニティで見つけた成長の羅針盤
kentosuzuki
0
130
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.6k
Greatest Disaster Hits in Web Performance
guaca
0
280
量子クラウドサービスの裏側 〜Deep Dive into OQTOPUS〜
oqtopus
0
140
Featured
See All Featured
The Curse of the Amulet
leimatthew05
1
8.7k
What's in a price? How to price your products and services
michaelherold
247
13k
The agentic SEO stack - context over prompts
schlessera
0
640
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.6k
Statistics for Hackers
jakevdp
799
230k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
410
Believing is Seeing
oripsolob
1
56
How GitHub (no longer) Works
holman
316
140k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
Transcript
Devise Taking care of your users Andreas Bjärlestam! 2011-02-22!
Andreas Bjärlestam mailto:
[email protected]
http://twitter.com/bjarlestam
So you are building a site with rails?
Hopefully you will have some users lining up...
They will probably f#&k things up USER USER STUPID
This could require quite some coding Signup page Login page
Account confirmation mails Password reset mails Password reset page Checks and redirects
You?
What to do?
DEVISE can do it!
DEVISE • User authentication • User signup • Account confirmaiton
• Password recovery • Remembering via cookie • Session expiration • Account locking http://github.com/plataformatec/devise
Lets code…
Create a rails project $>rails new devise_test $>cd devise_test $>gem
install devise $>echo "gem 'devise'" >> Gemfile $>rails generate devise:install $>cat config/routes.rb | sed s/'# root :to'/'root :to'/ >> config/routes.rb
Create a User model $>rails generate devise User $>rake db:migrate
Test it $>rails server $>open http://localhost:3000/users/sign_up $>open http://localhost:3000/users/sign_in $>open http://localhost:3000/users/sign_out
None
What happened?
configuration Configured routes config/routes.rb devise_for :users Configuration file and localization
config/initializers/devise.rb config/initializers/locales/devise.en.yml
User model class User < ActiveRecord::Base # Include default devise
modules. Others available are: # :token_authenticatable, :confirmable, :lockable and :timeoutable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me end
helpers available before_filter :authenticate_user! user_signed_in? current_user
customize views $>rails generate devise:views create app/views/devise create app/views/devise/confirmations/new.html.erb create
app/views/devise/mailer/confirmation_instructions.html.erb create app/views/devise/mailer/reset_password_instructions.html.erb create app/views/devise/mailer/unlock_instructions.html.erb create app/views/devise/passwords/edit.html.erb create app/views/devise/passwords/new.html.erb create app/views/devise/registrations/edit.html.erb create app/views/devise/registrations/new.html.erb create app/views/devise/sessions/new.html.erb create app/views/devise/shared/_links.erb create app/views/devise/unlocks/new.html.erb
None
Attributions • http://www.flickr.com/photos/weelakeo/3815108314/ • http://www.flickr.com/photos/nikio/3899114449/ • http://www.flickr.com/photos/zigazou76/3636704536/ • http://www.flickr.com/photos/myklroventine-events/3832058915/ •
http://www.flickr.com/photos/cokaigne/1401246909/ • http://www.flickr.com/photos/alpha/5434014952 • http://www.flickr.com/photos/alpha/5433405433