diff --git a/Gemfile b/Gemfile index f003f081..94d9e02b 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,6 @@ gem 'rails', '3.2.11' gem 'devise' gem 'redis' gem 'pg' -gem 'authlogic' gem 'cancan' gem 'formula' gem 'formtastic' diff --git a/Gemfile.lock b/Gemfile.lock index ed88ddf9..ae3beac5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,9 +29,6 @@ GEM i18n (~> 0.6) multi_json (~> 1.0) arel (3.0.2) - authlogic (3.1.0) - activerecord (>= 3.0.7) - activerecord (>= 3.0.7) bcrypt-ruby (3.0.1-x86-mingw32) best_in_place (2.0.2) jquery-rails @@ -131,7 +128,6 @@ PLATFORMS x86-mingw32 DEPENDENCIES - authlogic best_in_place cancan coffee-rails (~> 3.2.1) diff --git a/app/assets/images/menuicon.png b/app/assets/images/tab.png similarity index 80% rename from app/assets/images/menuicon.png rename to app/assets/images/tab.png index a72fd312..8e7f9e24 100644 Binary files a/app/assets/images/menuicon.png and b/app/assets/images/tab.png differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index fef406f2..0fbd9dd1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -42,6 +42,12 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, }); $(".scroll").mCustomScrollbar(); + + $('.headertop').draggable(); + var positionLeft = $(window).width() - $('.headertop').width() - 50; + $('.headertop').css('left', positionLeft + 'px'); + $('.notice.metamaps').delay(10000).fadeOut('fast'); + $('.alert.metamaps').delay(10000).fadeOut('fast'); //$('.nodemargin').css('padding-top',$('.focus').css('height')); @@ -304,11 +310,11 @@ function MconsoleReset() { function hideLabels() { if (Mconsole.labels.labelsHidden) { Mconsole.labels.hideLabels(); - $('.hidelabels').addClass('checked'); + $('.hidelabels').html('Hide Labels'); } else if (!Mconsole.labels.labelsHidden) { Mconsole.labels.hideLabels(true); - $('.hidelabels').removeClass('checked'); + $('.hidelabels').html('Show Labels'); } } diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 154e7f0d..a5eaf257 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -59,8 +59,7 @@ html { body { background:#031924 url(background2-for-repeating.jpg) repeat 0 0; - /* font-family: 'katarine-web', sans-serif; */ - font-family: 'LatoLight', sans-serif; + font-family: 'katarine-web', sans-serif; background-attachment:fixed; color:#FFF; } @@ -142,9 +141,10 @@ a { margin:200px 0 0 -195px; background: url('bg.png'); padding: 20px; - border-radius: 15px; + border-radius: 5px; color: #000; - border:2px solid #000; + border:1px solid #000; + box-shadow: 6px 6px 8px rgba(0,0,0,0.4); } .edit_user{ @@ -268,52 +268,64 @@ input[type="submit"] { } /* --- top options --*/ + +.passwordnotice { + background: #612127; + padding: 10px; + margin-bottom: 10px; + text-align: center; +} + +.notice.metamaps, .alert.metamaps { +position: absolute; +margin: 20px; +background: url(/assets/black_bg.png); +padding: 10px; +border-radius: 5px; +box-shadow: 6px 6px 8px rgba(0,0,0,0.4); + border:1px solid #000; +} + .headertop { display:block; position:fixed; - top:0; - right:0; + top:20px; z-index:10; - width:218px; - border-radius:10px; + border-radius:5px; margin: 10px 0px 10px 10px; - background:#FFF; + background:#111614; padding:5px 10px; - border:1px solid #000; box-shadow: 6px 6px 8px rgba(0,0,0,0.4); } +.headertop .tab { + background: url(tab.png) no-repeat 0 0; + position:absolute; + top:-11px; + right:-2px; + display:block; + width:45px; + height:15px; + cursor:move; +} + .headertop button, .headertop input { - float:right; height: 30px; - border-radius: 3px; - background: #FFF; - color: #111; - font-family: 'katarine-web'; - font-size: 18px; - border: 1px solid #000; + background: none; + color: #717474; + font-family: 'LatoLight'; + font-size: 17px; + border: none; + border-right:1px solid #717474; cursor: pointer; margin:3px 0; clear:both; + float:right; } .headertop button:hover, .headertop input:hover { - background: #EEE; -} - -.hidelabels { -width: 80px; -height: 25px; -float: right; -background: url('labelCheckbox.png') no-repeat 0px -36px; -display: block; -padding-left: 34px; -padding-top:6px; -cursor:pointer; -color:#111; -} -.hidelabels.checked { -background: url('labelCheckbox.png') no-repeat 0px 0px; + border-right: 1px solid #6d7310; + color: #6d7310; } .wrapper { @@ -329,12 +341,15 @@ background: url('labelCheckbox.png') no-repeat 0px 0px; z-index: 9999; width: auto; background: url('black_bg.png'); - padding: 0px 10px 0px 20px; - border-bottom-left-radius: 15px; - border-top-left-radius: 15px; - height: 38px; + padding: 1px 10px 0px 20px; + border-bottom-left-radius: 5px; + border-top-left-radius: 5px; + text-transform:uppercase; + font-style:italic; + height: 35px; font-size: 30px; line-height: 38px; + border:1px solid #000; } .nodemargin { diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 620c3cb7..2a7b3ceb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,16 +22,6 @@ private end end - def current_user - return @current_user if defined?(@current_user) - @current_user = current_session && current_session.user - end - - def current_session - return @current_session if defined?(@current_session) - @current_session = Session.find - end - def user current_user end @@ -41,14 +31,4 @@ private current_user end - def store - session[:location] = request.fullpath - end - - def restore(options) - location = session[:location] || options[:default] - session[:location] = nil - return location - end - end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7b5a00ec..b7b3f945 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -9,6 +9,11 @@ class UsersController < ApplicationController # GET /user/new def new + + flash[:notice] = "Account creation is temporarily disabled." + redirect_to root_url + return + @user = User.new respond_with(@user) @@ -36,6 +41,9 @@ class UsersController < ApplicationController # POST /user def create + + # update this code + @session = Session.create(params[:user]) redirect_to(root_url) and return if @session.valid? diff --git a/app/models/session.rb b/app/models/session.rb deleted file mode 100644 index 45ec37ba..00000000 --- a/app/models/session.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Session < Authlogic::Session::Base - - authenticate_with User - -end diff --git a/app/models/user.rb b/app/models/user.rb index 3af99561..196946a5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,26 +7,17 @@ has_many :synapses has_many :maps has_many :mappings - acts_as_authentic do |configuration| - configuration.session_class = Session - configuration.require_password_confirmation = false + devise :database_authenticatable, :recoverable, :rememberable, :trackable # :registerable + + #acts_as_authentic do |configuration| + # configuration.session_class = Session + #configuration.require_password_confirmation = false - configuration.merge_validates_format_of_email_field_options unless: Proc.new { |user| user.email.blank? and user.authed? } - configuration.merge_validates_length_of_email_field_options unless: Proc.new { |user| user.email.blank? and user.authed? } - end + # configuration.merge_validates_format_of_email_field_options unless: Proc.new { |user| user.email.blank? and user.authed? } + # configuration.merge_validates_length_of_email_field_options unless: Proc.new { |user| user.email.blank? and user.authed? } + #end serialize :settings, UserPreference - - validates :password, :presence => true, - :length => { - :maximum => 20, - :too_long => "is too long (maximum is %{count} characters)" }, - :on => :create - validates :password, :allow_blank => true, - :length => { - :maximum => 20, - :too_long => "is too long (maximum is %{count} characters)"}, - :on => :update validates :joinedwithcode, :presence => true, :inclusion => { :in => User.all.map(&:code), :message => "%{value} is not a valid code" }, :on => :create diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e461f3ae..9dc6750a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -36,6 +36,14 @@ <%= csrf_meta_tags %>
+ + <% if notice %> + + <% end %> + <% if alert %> + + <% end %> + <%= content_tag :div, class: authenticated? ? "main authenticated" : "main unauthenticated" do %>Welcome <%= @email %>!
+ +You can confirm your account email through the link below:
+ +<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb new file mode 100644 index 00000000..c0444a6d --- /dev/null +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -0,0 +1,11 @@ +Hey there Metamapper with email <%= @resource.email %>!
+ +Please create a new password. Your password needs to contain a capital letter, a number, an emoji, 7 elements from the Periodic Table, and a plot containing a protagonist with some character development and a surprise twist ending.
+ +Just kidding. But it does have to be between 8 and 128 characters.
+ +Change your password using the link below.
+ +<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
+ +If you didn't request this, click your heels three times and pretend nothing ever happened.
diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb new file mode 100644 index 00000000..a4152e13 --- /dev/null +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +Hello <%= @resource.email %>!
+ +Your account has been locked due to an excessive number of unsuccessful sign in attempts.
+ +Click the link below to unlock your account:
+ +<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 9a554b28..7802052c 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -12,7 +12,8 @@ <%= form.input :email, label: "Email", class: "email" %> <%= form.input :password, label: "Password", class: "password" %> <%= form.input :joinedwithcode, label: "Access Code", class: "joinedwithcode" %> - <%= form.submit "Create Account", class: "add" %> + <%= form.submit "Create Account", class: "add" %> + <%= link_to "Sign in", new_session_path("user") %> <% end %> diff --git a/app/views/users/passwords/edit.html.erb b/app/views/users/passwords/edit.html.erb new file mode 100644 index 00000000..136b6366 --- /dev/null +++ b/app/views/users/passwords/edit.html.erb @@ -0,0 +1,20 @@ + + +<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> + <%= devise_error_messages! %> + <%= f.hidden_field :reset_password_token %> + +Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.
+ +<%= link_to "Back", :back %> diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb new file mode 100644 index 00000000..3f189d46 --- /dev/null +++ b/app/views/users/registrations/new.html.erb @@ -0,0 +1,18 @@ +"+e+" topics
"+t+" synapses
")}function closeAnalyze(){analyzeOpen=!1,$("#closeAnalyze").css("display","none"),$("#sideOptionAnalyze").css("cursor","pointer"),$("#sideOptionAnalyze").animate({width:"64px",height:"32px"},100)}function switchVisible(e,t){categoryVisible[e]==1?hideCategory(e,t):categoryVisible[e]==0&&showCategory(e,t)}function hideCategory(e,t){t==null&&(t=500),Mconsole.graph.eachNode(function(t){t.getData("metacode")==e&&(t.setData("alpha",.4,"end"),t.eachAdjacency(function(e){e.setData("alpha",.4,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:t})}function showCategory(e,t){t==null&&(t=500),Mconsole.graph.eachNode(function(t){t.getData("metacode")==e&&(t.setData("alpha",1,"end"),t.eachAdjacency(function(e){e.setData("alpha",1,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:t})}function hideAll(e){e==null&&(e=500),Mconsole.graph.eachNode(function(e){!e.getData("greenCircle")&&!e.getData("whiteCircle")&&(e.setData("alpha",.4,"end"),e.eachAdjacency(function(e){e.setData("alpha",.4,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function showAll(e){e==null&&(e=500),Mconsole.graph.eachNode(function(e){e.setData("alpha",1,"end"),e.eachAdjacency(function(e){e.setData("alpha",1,"end")})}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function onCanvasSearch(e,t,n){e=name.toLowerCase(),Mconsole.graph.eachNode(function(r){nodeName=r.name.toLowerCase(),name!=null?nodeName.indexOf(e)!==-1&&e!=""?r.setData("whiteCircle",!0):r.setData("whiteCircle",!1):t!=null?r.getData("inmaps").indexOf(parseInt(t))!==-1?r.setData("whiteCircle",!0):r.setData("whiteCircle",!1):n!=null&&(r.getData("userid").toString()==n?r.setData("whiteCircle",!0):r.setData("whiteCircle",!1)),Mconsole.plot()})}function clearCanvas(){Mconsole.graph.eachNode(function(e){Mconsole.graph.removeNode(e.id),Mconsole.labels.disposeLabel(e.id),delete Mconsole.labels.labels[""+e.id]}),Mconsole.plot()}function clearCanvasExceptRoot(){var e=new Array;Mconsole.graph.eachNode(function(t){e.push(t.id)});var t=Mconsole.graph.nodes[Mconsole.root];e.forEach(function(e,n){e!=t.id&&(Mconsole.graph.removeNode(e),Mconsole.labels.hideLabel(e),$("#topic_"+e+"_label").hide())}),fetchRelatives(t)}function clearFoundData(){Mconsole.graph.eachNode(function(e){e.getData("greenCircle")===!0&&(Mconsole.graph.removeNode(e.id),Mconsole.labels.hideLabel(e.id),$("#topic_"+e.id+"_label").hide())}),Mconsole.plot()}function openFind(){findOpen=!0,analyzeOpen&&closeAnalyze(),organizeOpen&&closeOrganize(),$("#sideOptionFind, #closeFind").css("z-index","10"),$("#sideOptionAnalyze").css("z-index","9"),$("#sideOptionOrganize").css("z-index","8"),firstVal=$('#sideOptionFind option[value="name"]').attr("selected"),secondVal=$('#sideOptionFind option[value="metacode"]').attr("selected"),thirdVal=$('#sideOptionFind option[value="map (by name)"]').attr("selected"),fourthVal=$('#sideOptionFind option[value="mapper (by name)"]').attr("selected"),firstVal==="selected"||thirdVal==="selected"||fourthVal==="selected"?$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#topic_by_name_input").focus()}):secondVal==="selected"?$("#sideOptionFind").animate({width:"380px",height:"463px"},100,function(){}):thirdVal==="selected"?$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#map_by_name_input").focus()}):fourthVal==="selected"&&$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#mapper_by_name_input").focus()}),$("#closeFind, #findWhere").css("display","block"),$("#sideOptionFind").css("cursor","default")}function closeFind(){clearFoundData(),findOpen=!1,$("#closeFind, #findWhere").css("display","none"),$("#sideOptionFind").css("cursor","pointer"),$("#sideOptionFind").animate({width:"45px",height:"32px"},100)}function selectEdgeOnClickHandler(e,t){if(Mconsole.busy)return;if(t.altKey){editEdge(e,t);return}var n=MetamapsModel.selectedEdges.indexOf(e);n==-1?n=!1:n!=-1&&(n=!0),n&&t.shiftKey?deselectEdge(e):!n&&t.shiftKey?selectEdge(e):n&&!t.shiftKey?deselectAllEdges():!n&&!t.shiftKey&&(deselectAllEdges(),selectEdge(e)),Mconsole.plot()}function nodeDoubleClickHandler(e,t){keepFromCommons(e)}function enterKeyHandler(){var e=MetamapsModel.selectedNodes.slice(0),t=e.length;for(var r=0;rt |