fix IPv6 email regex, get ready for token registration
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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? }
|
||||
|
||||
@@ -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 <your-email></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>
|
||||
|
||||
Reference in New Issue
Block a user