Now able to update user profile even if discord field is blank #57
@ -51,5 +51,4 @@ module UsersHelper
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -18,11 +18,10 @@ class User < ActiveRecord::Base
|
|||||||
validates_length_of :name, in: 2..30
|
validates_length_of :name, in: 2..30
|
||||||
validates_length_of :about, maximum: 5000
|
validates_length_of :about, maximum: 5000
|
||||||
validates_length_of :ign, minimum: 1, maximum: 16
|
validates_length_of :ign, minimum: 1, maximum: 16
|
||||||
validates_length_of :discord, minimum: 2, maximum: 37 # The maximum length of a name is 32, but you need the # and four numbers
|
|
||||||
|
|
||||||
validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[(IPv6)?[0-9a-f:.]+\])\z/i, message: "That doesn't look like an email address."}
|
validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[(IPv6)?[0-9a-f:.]+\])\z/i, message: "That doesn't look like an email address."}
|
||||||
validates :ign, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z\d_]+\z/i, message: "Username is invalid (a-z, 0-9, _)."}
|
validates :ign, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z\d_]+\z/i, message: "Username is invalid (a-z, 0-9, _)."}
|
||||||
validates :discord, uniqueness: {case_sensitive: false}, format: {with: /\A^(?!everyone|here|discordtag|.*```.*)([^@#:]{2,32}#[0-9]{4})$\z/i, message: "Discord name is invalid."}
|
validates :discord, uniqueness: {case_sensitive: false}, format: {with: /\A^(?!everyone|here|discordtag|.*```.*)([^@#:]{2,32}#[0-9]{4})$\z/i, message: "Discord name is invalid."}, allow_blank: true
|
||||||
|
|
||||||
validates :public_key, format: {with: /\A(-----BEGIN PGP PUBLIC KEY BLOCK-----((.|\n)*?)-----END PGP PUBLIC KEY BLOCK-----)?\z/i, message: "That doesn't look like a PGP formatted public key."}
|
validates :public_key, format: {with: /\A(-----BEGIN PGP PUBLIC KEY BLOCK-----((.|\n)*?)-----END PGP PUBLIC KEY BLOCK-----)?\z/i, message: "That doesn't look like a PGP formatted public key."}
|
||||||
|
|
||||||
|
@ -82,15 +82,6 @@
|
|||||||
<td><b>Joined</b></td>
|
<td><b>Joined</b></td>
|
||||||
<td><%= ago @user.created_at %></td>
|
<td><%= ago @user.created_at %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% if mod? || @user.is?(current_user) %>
|
|
||||||
<tr>
|
|
||||||
<td><b>Last IP</b></td>
|
|
||||||
<td><%= @user.last_ip %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><b>Email</b></td>
|
|
||||||
<td><%= mail_to @user.email, @user.email, :subject => "Redstoner" %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>Last seen</b></td>
|
<td><b>Last seen</b></td>
|
||||||
<td>
|
<td>
|
||||||
@ -101,6 +92,15 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<% if mod? || @user.is?(current_user) %>
|
||||||
|
<tr>
|
||||||
|
<td><b>Last IP</b></td>
|
||||||
|
<td><%= @user.last_ip %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b>Email</b></td>
|
||||||
|
<td><%= mail_to @user.email, @user.email, :subject => "Redstoner" %></td>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Reference in New Issue
Block a user