11175
(-- --)
August 14, 2008, 1:11am
1
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
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 %><br />
<div class="acc_new">
<% form_for(@login , :url => update_login_members_path) do %>
<fieldset>
<legend>Inloggegevens</legend>
<label>Gebruikersnaam:</label><%= h(@login.user_name ) %><br /
<br />
<%= label(:login, :password, "* Wachtwoord:") %><%=
password_field(:login, :password, :size => 40) %> (minimaal 6
tekens) <br />
<%= label(:login, :password_confirmation, "* Wachtwoord 2:") %><
%= password_field(:login, :password_confirmation, :size => 40) %>
(minimaal 6 tekens)<br />
</fieldset>
<%= submit_tag 'Wijzigen' %>
<% end %>
</div>
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?
11175
(-- --)
August 18, 2008, 2:32am
3
Thorsten Mueller,
Does it work with Oracle?
Grabber
(Grabber)
August 18, 2008, 3:18am
4
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
This is the very basic flow to add new users. Google for something like it and learn
Regards,
11175
(-- --)
August 18, 2008, 3:40am
5