fix IPv6 email regex, get ready for token registration

This commit is contained in:
jomo
2014-05-04 23:03:11 +02:00
parent 2ec5238e37
commit 4ee8ce36f1
3 changed files with 3 additions and 4 deletions

View File

@@ -90,8 +90,7 @@ class UsersController < ApplicationController
@user.uuid = user_profile["id"]
@user.ign = user_profile["name"] # correct case
# TODO: uncomment when MC part works
if true # validate_token(@user.uuid, @user.email, params[:registration_token])
if true validate_token(@user.uuid, @user.email, params[:registration_token])
@user.last_ip = request.remote_ip # showing in mail
if @user.save
session[:user_id] = @user.id

View File

@@ -18,7 +18,7 @@ class User < ActiveRecord::Base
validates_length_of :about, maximum: 5000
validates_length_of :ign, minimum: 1, maximum: 16
validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[[0-9:.]+\])\z/i, message: "That doesn't look like an email adress."}
validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[[0-9a-f:.]+\])\z/i, message: "That doesn't look like an email adress."}
validates :ign, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z\d_]+\z/i, message: "Username is invalid (a-z, 0-9, _)."}
validate :account_exists?, :if => lambda {|user| user.ign_changed? }

View File

@@ -1,6 +1,6 @@
<h1>Sign up</h1>
<p>To get a <i>token</i>, join the Minecraft server (redstoner.com) and use the <code>/token &lt;your-email&gt;</code> command.</p>
<p>To get your <i>token</i>, join the Minecraft server (redstoner.com) and use the <mark>/token</mark> command.</p>
<%= form_for @user do |f| %>
<table>