# How to create a change password web form and send email noti

**URL:** <https://www.ruby-forum.com/t/how-to-create-a-change-password-web-form-and-send-email-noti/145800>\
**Category:** Rails\
**Created:** [August 14, 2008, 3:11am UTC](https://www.ruby-forum.com/t/how-to-create-a-change-password-web-form-and-send-email-noti/145800 "2008-08-14T03:11:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 14, 2008, 3:11am UTC](https://www.ruby-forum.com/t/how-to-create-a-change-password-web-form-and-send-email-noti/145800/1 "2008-08-14T03:11:15Z")

</div>

Hi all

I am looking for a web page or application that will allow an user to  
change his/her database password. I am thinking about a web form where  
end users enter the current password and the new password, hit submit  
and the new password replaces the old one. Then the web form sends an  
email notification

The database is an Oracle 10G database.

Is there any RoR project that does that?

thanks

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 14, 2008, 10:42am UTC](https://www.ruby-forum.com/t/how-to-create-a-change-password-web-form-and-send-email-noti/145800/2 "2008-08-14T10:42:16Z")

</div>

simple version from one of our apps:

model:

attr\_accessor :password\_confirmation  
attr\_protected :password, :password\_confirmation

validates\_confirmation\_of :password, :message =\> “the passwords don’t  
match”

form:

\<%= error\_messages\_for(:login) if @login %\>

 \<% form\_for(@login, :url =\> update\_login\_members\_path) do %\> Inloggegevens Gebruikersnaam:\<%= h(@login.user\_name) %\>  
  
 \<%= label(:login, :password, "\* Wachtwoord:") %\>\<%= password\_field(:login, :password, :size =\> 40) %\>&nbsp;(minimaal 6 tekens)   
 \<%= label(:login, :password\_confirmation, "\* Wachtwoord 2:") %\>\< %= password\_field(:login, :password\_confirmation, :size =\> 40) %\>&nbsp; (minimaal 6 tekens)  
 \<%= submit\_tag 'Wijzigen' %\> \<% end %\>

controller:

def update\_login  
@login = current\_login  
@login.password = params[:login][:password]  
@login.password\_confirmation = params[:login]  
[:password\_confirmation]

```
if @login.update_attributes(params[:login])
  flash[:notice] = 'Uw inlog gegevens zijn geupdate.'

# here would go your code to send an email

end
render :action => 'edit_login'

```

end

anything missing?

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 18, 2008, 4:32am UTC](https://www.ruby-forum.com/t/how-to-create-a-change-password-web-form-and-send-email-noti/145800/3 "2008-08-18T04:32:20Z")

</div>

Thorsten M.,

Does it work with Oracle?

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 18, 2008, 5:40am UTC](https://www.ruby-forum.com/t/how-to-create-a-change-password-web-form-and-send-email-noti/145800/4 "2008-08-18T05:40:10Z")

</div>

I’m using this: [GitHub - greenisus/forgot\_password: a forgot\_password plugin that works well with restful-authentication.](http://github.com/greenisus/forgot_password/tree/master)

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 18, 2008, 5:19am UTC](https://www.ruby-forum.com/t/how-to-create-a-change-password-web-form-and-send-email-noti/145800/5 "2008-08-18T05:19:03Z")

</div>

Pepe,

To use the mailing list define your problem better. okz? When the  
details  
and scope of the question has quality the answer may me too.

To create a project to use oracle database engine, do it:

rails --database=oracle project\_name

To add/delete users you’ll need to study something like:

UserController \<\< ApplicationController

def create  
@user = User.new(params[:user])  
if request.post?  
if @user.save  
render :text =\> ‘tasks completed’  
else  
render :text =\> ‘try again’  
end  
end  
end

At migration file:

class CreateUser \< ActiveRecord::Migration  
def self.up  
t.column :name, :string  
t.column :surname, :string  
t.email, :string  
t.timestamps  
end

def self.down  
drop\_tables :users  
end  
end

At user.rb

class User \<\< ActiveRecord::Base  
validates\_presence\_of :name, :surname, :email  
validates\_uniqueness\_of :email  
validates\_format\_of :email, :with =\>  
/^([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$/i  
end

At app/view/user/index.html.erb

\<% form\_for :user do |form| %\>

\<%= form.text\_field :email %\>  
\<%= form.text\_field :name %\>  
\<%= form.text\_field :surname %\>

\<%= submit\_tag ‘send’ %\>

\<% end %\>

Now you can see the form at: [http://localhost:3000/user/create](http://localhost:3000/user/create)

This is the very basic flow to add new users. Google for something like  
it  
and learn 😉

Regards,

On Sun, Aug 17, 2008 at 11:32 PM, Pepe S. \<  
removed\_email\_address@domain.invalid\> wrote:

> >

–  
Regards,

Luiz Vitor Martinez C.  
cel.: (11) 8187-8662  
blog: [rubz.org](http://rubz.org)  
engineer student at maua.br

“Posso nunca chegar a ser o melhor engenheiro do mundo, mas tenha  
certeza de  
que eu vou lutar com todas as minhas forÃ§as para ser o melhor engenheiro  
que  
eu puder ser”
