vedia/views/signup.erb

32 lines
1 KiB
Text

<h1><%= _("Create account") %></h1>
<% if @errors %>
<% @errors.each do |error| %>
<% if error.attribute == :password and error.type == :blank %>
<p class="error"><%= _("Specify a password.") %></p>
<% end %>
<% end %>
<% end %>
<% if @user and @user.errors.any? %>
<% @user.errors.each do |error| %>
<% if error.attribute == :email and error.type == :invalid %>
<p class="error"><%= _("Email is not a valid email address.") %></p>
<% end %>
<% if error.attribute == :email and error.type == :taken %>
<p class="error"><%= _("An account already exists for %{email}.") % { email: @user.email } %></p>
<% end %>
<% end %>
<% end %>
<form action="/signup" method="post">
<p>
<label for="email"><%= _("Email") %></label>
<input type="text" name="email" value="<%= params[:email] %>">
</p>
<p>
<label for="password"><%= _("Password") %></label>
<input type="password" name="password" value="<%= params[:password] %>">
</p>
<button type="submit"><%= _("Create account") %></button>
</form>