tmp
public/engine_files
.DS_Store
+vendor/plugins/sitealizer/lib/last_update
self.password = token_generator.token
end
end
+
+ protected
+ def validate
+ # E-mail regex, moderate complexity
+ # Stolen from http://www.regular-expressions.info/email.html
+ errors.add(:email, "is not valid") unless email =~
+ /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
+ end
end
attr_accessor :password
attr_accessor :current_user
- validates_presence_of :login, :email
+ validates_presence_of :email
validates_presence_of :password, :if => :password_required?
validates_presence_of :password_confirmation, :if => :password_required?
validates_length_of :password, :within => 4..40, :if => :password_required?
validates_confirmation_of :password, :if => :password_required?
validates_length_of :login, :within => 3..40
- validates_length_of :email, :within => 3..100
validates_uniqueness_of :login, :email, :case_sensitive => false
before_save :encrypt_password
def password_required?
crypted_password.blank? || !password.blank?
end
+ def validate
+ # E-mail regex, moderate complexity
+ # Stolen from http://www.regular-expressions.info/email.html
+ errors.add(:email, "is not valid") unless email =~
+ /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
+ errors.add(:login, "should not begin or end with spaces") if login.strip!
+ errors.add(:login, "should contain only letters, numbers, and spaces") unless login =~ /^[A-Za-z0-9 ]*$/
+ end
end
<% -%>
<div id="cand<%= @current_candidate.id %>">
- <li><%= @current_candidate.name -%>
+ <li><%=h @current_candidate.name -%>
<% if @show_details %>
(<%= link_to_remote "Hide Details",
:update => "cand#{@current_candidate.id}",
<% -%>
<div id="cand<%= @current_candidate.id %>">
-<p><strong><%= @current_candidate.name %></strong>
+<p><strong><%=h @current_candidate.name %></strong>
(<%= link_to_remote "Delete",
:complete => "Element.remove('cand#{@current_candidate.id}')",
:url => { :action => :delete_candidate,
<ul>
<% for candidate in @winners %>
- <li><%= @candidates_by_id[candidate].name %></li>
+ <li><%=h @candidates_by_id[candidate].name %></li>
<% end %>
</ul>
<% winner = @winners[0] %>
<p>The winner of the election was:
- <strong><%= @candidates_by_id[winner].name %></strong>
+ <strong><%=h @candidates_by_id[winner].name %></strong>
</p>
<% end %>
<tr>
<th></th>
<% for candidate in @election.candidates.sort %>
- <th><%= candidate.name %></th>
+ <th><%=h candidate.name %></th>
<% end %>
</tr>
<% for cand1 in @election.candidates.sort %>
<tr>
- <th><%= cand1.name %></th>
+ <th><%=h cand1.name %></th>
<% for cand2 in @election.candidates.sort %>
<td>
<% if cand1 == cand2 %>
-<h1><strong><%= @election.name %>:</strong> Edit Overview</h1>
+<h1><strong><%=h @election.name %>:</strong> Edit Overview</h1>
<% form_tag(:action => 'update', :id => @election) do %>
<%= render :partial => 'overview_form' %>
-<h1>Editing <%= @candidate.name %></h1>
+<h1>Editing <%=h @candidate.name %></h1>
<%= error_messages_for :candidate %>
<% form_tag( { :action => :update_candidate, :id => @candidate.id },
<% for election in @elections %>
<tr>
- <td valign="top"><h2><%= link_to election.name, :action => 'show', :id => election %></h2>
+ <td valign="top"><h2><%=h link_to election.name, :action => 'show', :id => election %></h2>
<p><strong>Description:</strong></p>
- <blockquote><%= election.description %></blockquote>
+ <blockquote><%=h election.description %></blockquote>
<p><strong>Election Information:</strong></p>
<ul>
<% @edit = true %>
-<h1><strong><%= @election.name %>:</strong> Enter List of Voter Email Addresses</h1>
+<h1><strong><%=h @election.name %>:</strong> Enter List of Voter Email Addresses</h1>
<%= render :partial => 'voter_list' %>
<ul>
<li><%= link_to( "Create a QuickVote", :controller => 'quickvote', :action => 'create') %></li>
- <li><%= link_to( "Recent QuickVotes", :controller => 'quickvote', :action => 'my_quickvotes')%></li>
+ <li><%= link_to( "My Recent QuickVotes", :controller => 'quickvote', :action => 'my_quickvotes')%></li>
</ul>
<p>Recently created <em>QuickVotes</em> include:</p>
+++ /dev/null
-Wed Aug 29 13:54:03 -0400 2007